qt-chat-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

mod.rs (2075B)


      1 //! Auto-generated types from TrailBase JSON schemas
      2 //!
      3 //! Generated using: ./scripts/generate-types.sh
      4 //! Do not edit manually - regenerate from schemas instead.
      5 
      6 use serde::{Deserialize, Serialize};
      7 
      8 /// Chat record from the database (read)
      9 #[derive(Debug, Clone, Serialize, Deserialize)]
     10 pub struct Chat {
     11     pub id: i64,
     12     pub title: String,
     13     pub created_at: String,
     14     pub created_by: String,
     15 }
     16 
     17 /// Input for creating a new chat (insert)
     18 /// Note: created_by is auto-populated by TrailBase from the authenticated user
     19 #[derive(Debug, Clone, Serialize, Deserialize)]
     20 pub struct NewChat {
     21     pub title: String,
     22     #[serde(skip_serializing_if = "Option::is_none", default)]
     23     pub id: Option<i64>,
     24     #[serde(skip_serializing_if = "Option::is_none", default)]
     25     pub created_at: Option<String>,
     26 }
     27 
     28 /// Message record from the database (read)
     29 #[derive(Debug, Clone, Serialize, Deserialize)]
     30 pub struct Message {
     31     pub id: i64,
     32     pub chat_id: i64,
     33     pub content: String,
     34     #[serde(default)]
     35     pub sender_id: Option<String>,
     36     pub sent_at: String,
     37 }
     38 
     39 /// Input for creating a new message (insert)
     40 /// Note: sender_id is auto-populated by TrailBase from the authenticated user
     41 #[derive(Debug, Clone, Serialize, Deserialize)]
     42 pub struct NewMessage {
     43     pub chat_id: i64,
     44     pub content: String,
     45     #[serde(skip_serializing_if = "Option::is_none", default)]
     46     pub id: Option<i64>,
     47     #[serde(skip_serializing_if = "Option::is_none", default)]
     48     pub sent_at: Option<String>,
     49 }
     50 
     51 /// User chats view record (from user_chats view)
     52 #[derive(Debug, Clone, Serialize, Deserialize)]
     53 pub struct UserChat {
     54     pub id: i64,
     55     pub title: String,
     56     pub created_at: String,
     57     pub created_by: String,
     58     pub user_id: String,
     59 }
     60 
     61 /// Input for creating chat participation (insert)
     62 /// Note: user_id is auto-populated by TrailBase from the authenticated user
     63 #[derive(Debug, Clone, Serialize, Deserialize)]
     64 pub struct NewChatParticipation {
     65     pub chat_id: i64,
     66     #[serde(skip_serializing_if = "Option::is_none", default)]
     67     pub id: Option<i64>,
     68 }