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