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, pub is_pinned: bool, pub edited_at: Option, pub created_at: OffsetDateTime, pub updated_at: Option, pub deleted_at: Option, pub deleted_by: Option, #[sea_orm(belongs_to, from = "post_id", to = "id")] pub post: BelongsTo, #[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")] pub author: BelongsTo, #[sea_orm( self_ref, relation_enum = "Parent", relation_reverse = "Children", from = "parent_reply_id", to = "id" )] pub parent: HasOne, #[sea_orm(belongs_to, relation_enum = "Deleter", from = "deleted_by", to = "uid")] pub deleter: BelongsTo>, } impl ActiveModelBehavior for ActiveModel {}