use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "chat_thread")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(indexed)] pub room_id: Uuid, #[sea_orm(unique_key = "chat_thread_root_message")] pub root_message_id: Uuid, pub owner_id: i64, pub name: Option, #[sea_orm(default_value = 0)] pub reply_count: i64, #[sea_orm(default_value = 0)] pub participant_count: i64, pub last_reply_id: Option, pub last_reply_at: Option, #[sea_orm(default_value = "false")] pub archived: bool, #[sea_orm(default_value = "false")] pub locked: bool, pub auto_archive_minutes: Option, pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, #[sea_orm(belongs_to, from = "room_id", to = "id")] pub room: BelongsTo, #[sea_orm(belongs_to, from = "owner_id", to = "uid")] pub owner: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}