a06673b
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
use super::project_health::ProjectHealth;
use super::project_state::ProjectState;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "project")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub space_id: Uuid,
pub creator_id: Uuid,
pub name: String,
pub description: Option<String>,
pub lead_id: Option<Uuid>,
pub icon: Option<String>,
pub color: Option<String>,
pub state: ProjectState,
pub target_date: Option<time::Date>,
pub started_at: Option<OffsetDateTime>,
pub completed_at: Option<OffsetDateTime>,
pub cancelled_at: Option<OffsetDateTime>,
pub health: Option<ProjectHealth>,
#[sea_orm(default_value = 0)]
pub sort_order: i32,
#[sea_orm(default_value = 0)]
pub starred: i32,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, from = "space_id", to = "id")]
pub space: BelongsTo<super::super::space::spaces::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 = "Lead", from = "lead_id", to = "uid")]
pub lead: BelongsTo<Option<super::super::user::users::Entity>>,
#[sea_orm(has_many)]
pub project_members: HasMany<super::project_members::Entity>,
#[sea_orm(has_many)]
pub project_views: HasMany<super::project_views::Entity>,
#[sea_orm(has_many)]
pub project_documents: HasMany<super::project_documents::Entity>,
#[sea_orm(has_many)]
pub project_activities: HasMany<super::project_activities::Entity>,
#[sea_orm(has_many)]
pub project_favorites: HasMany<super::project_favorites::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}