2024-12-22 20:56:52 -03:00
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2024-12-23 00:20:59 -03:00
|
|
|
pub struct Message {
|
2024-12-22 20:56:52 -03:00
|
|
|
pub id: Uuid,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub conversation_id: Uuid,
|
|
|
|
pub sender_id: Uuid,
|
|
|
|
pub content: String,
|
2024-12-22 20:56:52 -03:00
|
|
|
pub status: String,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub message_type: String,
|
|
|
|
pub kind: String, // Add this field
|
|
|
|
pub shard_key: i32,
|
2024-12-22 20:56:52 -03:00
|
|
|
pub created_at: DateTime<Utc>,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Instance {
|
|
|
|
pub id: Uuid,
|
|
|
|
pub customer_id: Uuid,
|
|
|
|
pub name: String,
|
|
|
|
pub shard_id: i32,
|
|
|
|
pub created_at: DateTime<Utc>,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Room {
|
|
|
|
pub id: Uuid,
|
|
|
|
pub instance_id: Uuid,
|
|
|
|
pub name: String,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub is_active: bool,
|
2024-12-22 20:56:52 -03:00
|
|
|
pub created_at: DateTime<Utc>,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2024-12-23 00:20:59 -03:00
|
|
|
pub struct Track {
|
2024-12-22 20:56:52 -03:00
|
|
|
pub id: Uuid,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub room_id: Uuid,
|
|
|
|
pub user_id: Uuid,
|
|
|
|
pub media_type: String,
|
2024-12-22 20:56:52 -03:00
|
|
|
pub created_at: DateTime<Utc>,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2024-12-23 00:20:59 -03:00
|
|
|
pub struct User {
|
2024-12-22 20:56:52 -03:00
|
|
|
pub id: Uuid,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub instance_id: Uuid,
|
|
|
|
pub email: String,
|
|
|
|
pub name: String,
|
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2024-12-23 00:20:59 -03:00
|
|
|
pub struct Customer {
|
2024-12-22 20:56:52 -03:00
|
|
|
pub id: Uuid,
|
|
|
|
pub name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub created_at: DateTime<Utc>,
|
2024-12-23 00:20:59 -03:00
|
|
|
pub updated_at: DateTime<Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct RoomConfig {
|
|
|
|
pub instance_id: Uuid,
|
|
|
|
pub name: String,
|
|
|
|
pub max_participants: u32,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
|
|
|
|
2024-12-23 00:20:59 -03:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Connection {
|
|
|
|
pub id: Uuid,
|
|
|
|
pub room_id: Uuid,
|
|
|
|
pub user_id: Uuid,
|
|
|
|
pub connected_at: DateTime<Utc>,
|
2024-12-22 20:56:52 -03:00
|
|
|
}
|
2024-12-23 00:20:59 -03:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct TrackInfo {
|
|
|
|
pub room_id: Uuid,
|
|
|
|
pub user_id: Uuid,
|
|
|
|
pub media_type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Subscription {
|
|
|
|
pub id: Uuid,
|
|
|
|
pub track_id: Uuid,
|
|
|
|
pub subscriber_id: Uuid,
|
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Participant {
|
|
|
|
pub user_id: Uuid,
|
|
|
|
pub room_id: Uuid,
|
|
|
|
pub joined_at: DateTime<Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct RoomStats {
|
|
|
|
pub participant_count: u32,
|
|
|
|
pub track_count: u32,
|
|
|
|
pub duration: i64,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct MessageId(pub Uuid);
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct MessageFilter {
|
|
|
|
pub conversation_id: Option<Uuid>,
|
|
|
|
pub sender_id: Option<Uuid>,
|
|
|
|
pub from_date: Option<DateTime<Utc>>,
|
|
|
|
pub to_date: Option<DateTime<Utc>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct Status {
|
|
|
|
pub code: String,
|
|
|
|
pub timestamp: DateTime<Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct SearchQuery {
|
|
|
|
pub query: String,
|
|
|
|
pub conversation_id: Option<Uuid>,
|
|
|
|
pub from_date: Option<DateTime<Utc>>,
|
|
|
|
pub to_date: Option<DateTime<Utc>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct FileUpload {
|
|
|
|
pub content: Vec<u8>,
|
|
|
|
pub filename: String,
|
|
|
|
pub content_type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct FileInfo {
|
|
|
|
pub id: Uuid,
|
|
|
|
pub filename: String,
|
|
|
|
pub content_type: String,
|
|
|
|
pub size: u64,
|
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct FileContent {
|
|
|
|
pub content: Vec<u8>,
|
|
|
|
pub content_type: String,
|
|
|
|
}
|
|
|
|
|