use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use uuid::Uuid; #[derive( Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize, )] #[sea_orm(rs_type = "i32", db_type = "SmallInteger")] pub enum AllowJoinLevel { #[default] None = 0, NeedMailActive = 1, NeedMailActiveAndLastOneMid = 2, NeedMailActiveAndLastOneHours = 3, NeedMailActiveAndPhoneActive = 4, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "spaces")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(unique)] pub lower_name: String, pub name: String, pub description: Option, pub owner_id: Uuid, pub avatar_url: Option, pub public: bool, pub is_active: bool, pub allow_join: bool, pub allow_invite: bool, pub invite_sort_url_hash: Option, pub member_count: i64, pub banner_url: Option, pub banner_width: Option, pub banner_height: Option, pub invite_banner_url: Option, pub invite_banner_width: Option, pub invite_banner_height: Option, pub embed_splash_url: Option, pub embed_splash_width: Option, pub embed_splash_height: Option, pub welcome_message: Option, pub allow_join_level: AllowJoinLevel, pub member_must_enable_2fa: bool, pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, #[sea_orm(belongs_to, from = "owner_id", to = "uid")] pub owner: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}