e034b46
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "admin_platform_bans")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub user_id: Uuid,
pub reason: Option<String>,
pub duration: Option<i64>,
pub banned_by: Uuid,
pub revoked_by: Option<Uuid>,
pub created_at: OffsetDateTime,
pub expires_at: Option<OffsetDateTime>,
pub revoked_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, relation_enum = "BannedUser", from = "user_id", to = "uid")]
pub user: BelongsTo<super::super::user::users::Entity>,
#[sea_orm(belongs_to, relation_enum = "BannedBy", from = "banned_by", to = "uid")]
pub ban_actor: BelongsTo<super::super::user::users::Entity>,
#[sea_orm(
belongs_to,
relation_enum = "RevokedBy",
from = "revoked_by",
to = "uid"
)]
pub revoker: BelongsTo<Option<super::super::user::users::Entity>>,
}
impl ActiveModelBehavior for ActiveModel {}