use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "space_bans")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub space_id: Uuid, #[sea_orm(primary_key, auto_increment = false)] pub user_id: i64, pub reason: Option, pub banned_by: i64, pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, pub expires_at: Option, pub allow_speak: bool, pub allow_push_repo: bool, pub allow_comment_any: bool, #[sea_orm(belongs_to, from = "space_id", to = "id")] pub space: BelongsTo, #[sea_orm(belongs_to, relation_enum = "BannedUser", from = "user_id", to = "uid")] pub user: BelongsTo, #[sea_orm(belongs_to, relation_enum = "BannedBy", from = "banned_by", to = "uid")] pub ban_actor: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}