Skip to content
Clone
e034b46
28 lines 1.0 KB Rust
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<Uuid>,
pub project_id: Option<Uuid>,
pub parent_id: Option<Uuid>,
pub poster_id: Uuid,
pub content: String,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, from = "issue_id", to = "id")]
pub issue: BelongsTo<Option<super::issue::Entity>>,
#[sea_orm(belongs_to, from = "project_id", to = "id")]
pub project: BelongsTo<Option<super::super::project::project::Entity>>,
#[sea_orm(belongs_to, from = "parent_id", to = "id")]
pub parent: BelongsTo<Option<super::comment::Entity>>,
#[sea_orm(belongs_to, from = "poster_id", to = "uid")]
pub poster: BelongsTo<super::super::user::users::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}