194c44c
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_read_state")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub user_id: i64,
#[sea_orm(primary_key, auto_increment = false)]
pub room_id: Uuid,
pub last_read_message_id: Option<Uuid>,
#[sea_orm(default_value = 0)]
pub last_read_seq: i64,
pub last_viewed_at: Option<OffsetDateTime>,
pub updated_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "user_id", to = "uid")]
pub user: BelongsTo<super::super::users::user::Entity>,
#[sea_orm(belongs_to, from = "room_id", to = "id")]
pub room: BelongsTo<super::super::room::rooms::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}