a06673b
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "post_reply")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub post_id: Uuid,
pub author_id: Uuid,
pub body: String,
pub parent_reply_id: Option<Uuid>,
pub is_pinned: bool,
pub edited_at: Option<OffsetDateTime>,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
pub deleted_at: Option<OffsetDateTime>,
pub deleted_by: Option<Uuid>,
#[sea_orm(belongs_to, from = "post_id", to = "id")]
pub post: BelongsTo<super::post::Entity>,
#[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")]
pub author: BelongsTo<super::super::user::users::Entity>,
#[sea_orm(
self_ref,
relation_enum = "Parent",
relation_reverse = "Children",
from = "parent_reply_id",
to = "id"
)]
pub parent: HasOne<Entity>,
#[sea_orm(belongs_to, relation_enum = "Deleter", from = "deleted_by", to = "uid")]
pub deleter: BelongsTo<Option<super::super::user::users::Entity>>,
}
impl ActiveModelBehavior for ActiveModel {}