eeff292
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<String>,
#[sea_orm(default_value = 0)]
pub reply_count: i64,
#[sea_orm(default_value = 0)]
pub participant_count: i64,
pub last_reply_id: Option<Uuid>,
pub last_reply_at: Option<OffsetDateTime>,
#[sea_orm(default_value = "false")]
pub archived: bool,
#[sea_orm(default_value = "false")]
pub locked: bool,
pub auto_archive_minutes: Option<i32>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "room_id", to = "id")]
pub room: BelongsTo<super::super::room::rooms::Entity>,
#[sea_orm(belongs_to, from = "owner_id", to = "uid")]
pub owner: BelongsTo<super::super::users::user::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}