App / src /models /message.rs
Devang Makwana
Deploy Rust backend to Hugging Face Spaces with LFS
c71a680
Raw
History Blame Contribute Delete
799 Bytes
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
use uuid::Uuid;
#[derive(Debug, Clone, FromRow, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Message {
#[serde(rename = "_id")]
pub id: Uuid,
pub conversation_id: Uuid,
pub sender_id: Uuid,
pub text: String,
pub message_type: String,
pub is_read: bool,
pub created_at: DateTime<Utc>,
pub file_name: Option<String>,
pub thumbnail_url: Option<String>,
}
#[allow(dead_code)]
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct MessageAttachment {
pub id: Uuid,
pub message_id: Uuid,
pub file_name: String,
pub file_path: String,
pub mime_type: String,
pub file_size: i64,
pub created_at: DateTime<Utc>,
}