use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "channel")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(indexed)] pub space_id: Option, pub name: String, #[sea_orm(indexed)] pub parent_id: Option, pub color: Option, pub position: i32, pub icon: Option, pub topic: Option, pub purpose: Option, #[sea_orm(default_value = "false")] pub is_archived: bool, pub archived_at: Option, pub archived_by: Option, #[sea_orm(indexed)] pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, #[sea_orm(indexed)] pub created_by: Uuid, #[sea_orm(belongs_to, from = "space_id", to = "id")] pub space: BelongsTo>, #[sea_orm( self_ref, relation_enum = "Parent", relation_reverse = "Children", from = "parent_id", to = "id" )] pub parent: HasOne, #[sea_orm(belongs_to, from = "created_by", to = "uid")] pub creator: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}