Some checks failed
Build Crate / build (push) Has been cancelled
Also integrated entities into codebase
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "user")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub username: String,
|
|
pub password: String,
|
|
pub salt: String,
|
|
pub creation_time: DateTimeWithTimeZone,
|
|
pub last_active_time: DateTimeWithTimeZone,
|
|
pub is_admin: bool,
|
|
pub email: Option<String>,
|
|
pub avatar: Option<String>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::team_result_to_user::Entity")]
|
|
TeamResultToUser,
|
|
}
|
|
|
|
impl Related<super::team_result_to_user::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::TeamResultToUser.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::team_result::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
super::team_result_to_user::Relation::TeamResult.def()
|
|
}
|
|
fn via() -> Option<RelationDef> {
|
|
Some(super::team_result_to_user::Relation::User.def().rev())
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|