26 lines
608 B
Rust
26 lines
608 B
Rust
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "users")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub uuid: Uuid,
|
|
pub user_id: String,
|
|
pub display_name: String,
|
|
pub password_hash: String,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::devices::Entity")]
|
|
Devices
|
|
}
|
|
|
|
impl Related<super::devices::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Devices.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|