Skip to content
Clone

feat(db): add project entity

zhenyi committed
parent c29f059 commit 195dd5b Browse files

1 file changed

+29 −3

Modified lib/db/project/project.rs View lib/db/project/project.rs
@@ -2,6 +2,9 @@
22use time::OffsetDateTime;
33use uuid::Uuid;
44
5use super::project_health::ProjectHealth;
6use super::project_state::ProjectState;
7
58#[sea_orm::model]
69#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
710#[sea_orm(table_name = "project")]
@@ -12,14 +15,37 @@
1215 pub creator_id: Uuid,
1316 pub name: String,
1417 pub description: Option<String>,
15 #[sea_orm(default_value = "false")]
16 pub is_closed: bool,
18 pub lead_id: Option<Uuid>,
19 pub icon: Option<String>,
20 pub color: Option<String>,
21 pub state: ProjectState,
22 pub target_date: Option<time::Date>,
23 pub started_at: Option<OffsetDateTime>,
24 pub completed_at: Option<OffsetDateTime>,
25 pub cancelled_at: Option<OffsetDateTime>,
26 pub health: Option<ProjectHealth>,
27 #[sea_orm(default_value = 0)]
28 pub sort_order: i32,
29 #[sea_orm(default_value = 0)]
30 pub starred: i32,
1731 pub created_at: OffsetDateTime,
1832 pub updated_at: Option<OffsetDateTime>,
1933 #[sea_orm(belongs_to, from = "space_id", to = "id")]
2034 pub space: BelongsTo<super::super::space::spaces::Entity>,
21 #[sea_orm(belongs_to, from = "creator_id", to = "uid")]
35 #[sea_orm(belongs_to, relation_enum = "Creator", from = "creator_id", to = "uid")]
2236 pub creator: BelongsTo<super::super::user::users::Entity>,
37 #[sea_orm(belongs_to, relation_enum = "Lead", from = "lead_id", to = "uid")]
38 pub lead: BelongsTo<Option<super::super::user::users::Entity>>,
39 #[sea_orm(has_many)]
40 pub project_members: HasMany<super::project_members::Entity>,
41 #[sea_orm(has_many)]
42 pub project_views: HasMany<super::project_views::Entity>,
43 #[sea_orm(has_many)]
44 pub project_documents: HasMany<super::project_documents::Entity>,
45 #[sea_orm(has_many)]
46 pub project_activities: HasMany<super::project_activities::Entity>,
47 #[sea_orm(has_many)]
48 pub project_favorites: HasMany<super::project_favorites::Entity>,
2349}
2450
2551impl ActiveModelBehavior for ActiveModel {}