init
This commit is contained in:
10
ticktalk/crates/types/Cargo.toml
Executable file
10
ticktalk/crates/types/Cargo.toml
Executable 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" }
|
||||
54
ticktalk/crates/types/src/lib.rs
Executable file
54
ticktalk/crates/types/src/lib.rs
Executable 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,
|
||||
}
|
||||
Reference in New Issue
Block a user