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 = "project_documents")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(unique_key = "project_slug")]
pub project_id: Uuid,
pub parent_id: Option<Uuid>,
pub creator_id: Uuid,
pub last_editor_id: Option<Uuid>,
pub title: String,
#[sea_orm(unique_key = "project_slug")]
pub slug: String,
#[sea_orm(default_value = "")]
pub content: String,
pub icon: Option<String>,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, from = "project_id", to = "id")]
pub project: BelongsTo<super::project::Entity>,
#[sea_orm(belongs_to, from = "parent_id", to = "id")]
pub parent: BelongsTo<Option<super::project_documents::Entity>>,
#[sea_orm(belongs_to, relation_enum = "Creator", from = "creator_id", to = "uid")]
pub creator: BelongsTo<super::super::user::users::Entity>,
#[sea_orm(belongs_to, relation_enum = "LastEditor", from = "last_editor_id", to = "uid")]
pub last_editor: BelongsTo<Option<super::super::user::users::Entity>>,
}
impl ActiveModelBehavior for ActiveModel {}