use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "users")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(unique)]
pub username: String,
#[sea_orm(unique)]
pub email: String,
pub password_hash: String,
pub is_active: bool,
/// Staff/admin: can manage categories and (later) moderate.
pub is_staff: bool,
/// Preferred topic-list sort (latest|top|bottom|hot), applied forum-wide.
pub preferred_sort: String,
/// Receive a notification when someone reacts to your post.
pub reaction_notifications: bool,
/// Discourse-style trust level 0–4 (New/Basic/Member/Regular/Leader).
pub trust_level: i32,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub last_login_at: Option<DateTimeWithTimeZone>,
/// When the current email address was verified (None = unverified: the
/// account can read but not post, react, bookmark or tag).
pub email_verified_at: Option<DateTimeWithTimeZone>,
/// Uploaded avatar image bytes (None = use the generated letter avatar).
/// `avatar_data` is skipped from serde so the bytes never bloat template
/// contexts; `avatar_content_type` is serialized so templates can tell
/// whether to show the uploaded image or the themed letter avatar.
#[serde(skip)]
pub avatar_data: Option<Vec<u8>>,
pub avatar_content_type: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::user_sessions::Entity")]
UserSessions,
}
impl Related<super::user_sessions::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserSessions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions running · Badges · Packages
⭐
Log in to mark this repository.
1.9 KiB · text
History
de2cabc