a06673b
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_pinned_messages")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub chat_id: Uuid,
pub message_id: Uuid,
pub pinned_by: Uuid,
pub created_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "chat_id", to = "id")]
pub chat: BelongsTo<super::chats::Entity>,
#[sea_orm(belongs_to, from = "message_id", to = "id")]
pub message: BelongsTo<super::chat_messages::Entity>,
#[sea_orm(belongs_to, relation_enum = "Pinner", from = "pinned_by", to = "uid")]
pub pinner: BelongsTo<super::super::user::users::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}