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 = "channel")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(indexed)]
pub space_id: Option<Uuid>,
pub name: String,
#[sea_orm(indexed)]
pub parent_id: Option<Uuid>,
pub color: Option<String>,
pub position: i32,
pub icon: Option<String>,
pub topic: Option<String>,
pub purpose: Option<String>,
#[sea_orm(default_value = "false")]
pub is_archived: bool,
pub archived_at: Option<OffsetDateTime>,
pub archived_by: Option<Uuid>,
#[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<Option<super::super::space::spaces::Entity>>,
#[sea_orm(
self_ref,
relation_enum = "Parent",
relation_reverse = "Children",
from = "parent_id",
to = "id"
)]
pub parent: HasOne<Entity>,
#[sea_orm(belongs_to, from = "created_by", to = "uid")]
pub creator: BelongsTo<super::super::user::users::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}