This commit is contained in:
root
2025-12-14 10:39:18 +03:00
commit 639f4e2b4e
179 changed files with 21065 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
[package]
name = "ticktalk-types"
version = "0.1.0"
edition = "2024"
[dependencies]
serde = { workspace = true }
uuid = { workspace = true }
chrono = { workspace = true }
# ticktalk-db = { path = "../db" }

View File

@@ -0,0 +1,54 @@
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatResponse {
pub id: Uuid,
pub first_user_id: Uuid,
pub second_user_id: Uuid,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MessageResponse {
pub sender_id: Uuid,
pub recipient_id: Uuid,
pub content: String,
pub created_at: NaiveDateTime,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateChatRequest {
pub first_user_id: Uuid,
pub second_user_id: Uuid,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateMessageRequest {
pub chat_id: Uuid,
pub sender_id: Uuid,
pub recipient_id: Uuid,
pub content: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserResponse {
pub id: Uuid,
pub username: String,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct CreateUserRequest {
pub username: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LoginRequest {
pub ticket: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LoginResponse {
pub session_id: Uuid,
pub user: UserResponse,
}