use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "comment")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub issue_id: Option, pub project_id: Option, pub parent_id: Option, pub poster_id: Uuid, pub content: String, pub created_at: OffsetDateTime, pub updated_at: Option, #[sea_orm(belongs_to, from = "issue_id", to = "id")] pub issue: BelongsTo>, #[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, from = "poster_id", to = "uid")] pub poster: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}