Skip to content
Clone

feat(db): add project_documents entity

zhenyi committed
parent 939c224 commit 151618a Browse files

1 file changed

+34 −0

Added lib/db/project/project_documents.rs View lib/db/project/project_documents.rs
@@ -0,0 +1,34 @@
1use sea_orm::entity::prelude::*;
2use time::OffsetDateTime;
3use uuid::Uuid;
4
5#[sea_orm::model]
6#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
7#[sea_orm(table_name = "project_documents")]
8pub struct Model {
9 #[sea_orm(primary_key, auto_increment = false)]
10 pub id: Uuid,
11 #[sea_orm(unique_key = "project_slug")]
12 pub project_id: Uuid,
13 pub parent_id: Option<Uuid>,
14 pub creator_id: Uuid,
15 pub last_editor_id: Option<Uuid>,
16 pub title: String,
17 #[sea_orm(unique_key = "project_slug")]
18 pub slug: String,
19 #[sea_orm(default_value = "")]
20 pub content: String,
21 pub icon: Option<String>,
22 pub created_at: OffsetDateTime,
23 pub updated_at: Option<OffsetDateTime>,
24 #[sea_orm(belongs_to, from = "project_id", to = "id")]
25 pub project: BelongsTo<super::project::Entity>,
26 #[sea_orm(belongs_to, from = "parent_id", to = "id")]
27 pub parent: BelongsTo<Option<super::project_documents::Entity>>,
28 #[sea_orm(belongs_to, relation_enum = "Creator", from = "creator_id", to = "uid")]
29 pub creator: BelongsTo<super::super::user::users::Entity>,
30 #[sea_orm(belongs_to, relation_enum = "LastEditor", from = "last_editor_id", to = "uid")]
31 pub last_editor: BelongsTo<Option<super::super::user::users::Entity>>,
32}
33
34impl ActiveModelBehavior for ActiveModel {}