2025-05-07 20:23:22 -04:00
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
|
|
|
|
#[sea_orm(table_name = "users")]
|
|
|
|
|
pub struct Model {
|
|
|
|
|
#[sea_orm(primary_key)]
|
2025-06-06 19:03:08 -04:00
|
|
|
pub id: i32,
|
2025-05-07 20:23:22 -04:00
|
|
|
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,
|
2025-07-20 18:31:08 -04:00
|
|
|
#[sea_orm(has_many = "super::multiplayer_game_player::Entity")]
|
|
|
|
|
Player,
|
2026-02-01 18:14:16 -05:00
|
|
|
#[sea_orm(has_many = "super::factory::vehicle::Entity")]
|
|
|
|
|
FactoryUploads,
|
2025-05-07 20:23:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-20 18:31:08 -04:00
|
|
|
impl Related<super::multiplayer_game_player::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::Player.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-01 18:14:16 -05:00
|
|
|
impl Related<super::factory::vehicle::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::FactoryUploads.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-07 20:23:22 -04:00
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|