mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
53 lines
1.2 KiB
Rust
53 lines
1.2 KiB
Rust
|
|
use sea_orm::entity::prelude::*;
|
||
|
|
|
||
|
|
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||
|
|
#[sea_orm(table_name = "users")]
|
||
|
|
pub struct Model {
|
||
|
|
#[sea_orm(primary_key)]
|
||
|
|
pub id: u32,
|
||
|
|
pub creation_time: i64, // seconds since unix epoch
|
||
|
|
pub public_id: String,
|
||
|
|
pub display_name: String,
|
||
|
|
pub password: String,
|
||
|
|
pub email: String,
|
||
|
|
pub steam_id: Option<String>, // u64
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||
|
|
pub enum Relation {
|
||
|
|
#[sea_orm(has_one = "super::permissions::Entity")]
|
||
|
|
Permission,
|
||
|
|
#[sea_orm(has_many = "super::garage::Entity")]
|
||
|
|
Garages,
|
||
|
|
#[sea_orm(has_many = "super::user_aux::Entity")]
|
||
|
|
Aux,
|
||
|
|
#[sea_orm(has_many = "super::campaign::Entity")]
|
||
|
|
Campaigns,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Related<super::permissions::Entity> for Entity {
|
||
|
|
fn to() -> RelationDef {
|
||
|
|
Relation::Permission.def()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Related<super::garage::Entity> for Entity {
|
||
|
|
fn to() -> RelationDef {
|
||
|
|
Relation::Garages.def()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Related<super::user_aux::Entity> for Entity {
|
||
|
|
fn to() -> RelationDef {
|
||
|
|
Relation::Aux.def()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Related<super::campaign::Entity> for Entity {
|
||
|
|
fn to() -> RelationDef {
|
||
|
|
Relation::Campaigns.def()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl ActiveModelBehavior for ActiveModel {}
|