31 lines
793 B
Rust
31 lines
793 B
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
|
|
|
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: i64,
|
|
#[sea_orm(unique)]
|
|
pub name: String,
|
|
pub password: String,
|
|
pub is_admin: bool,
|
|
pub can_download: bool,
|
|
pub scrobbling_enabled: bool,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::user_session::Entity")]
|
|
UserSession,
|
|
}
|
|
|
|
impl Related<super::user_session::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::UserSession.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|