Skip to main content

kellnr_entity/
user.rs

1//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.17
2
3use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "user")]
7pub struct Model {
8    #[sea_orm(primary_key)]
9    pub id: i64,
10    #[sea_orm(column_type = "Text", unique)]
11    pub name: String,
12    #[sea_orm(column_type = "Text")]
13    pub pwd: String,
14    #[sea_orm(column_type = "Text")]
15    pub salt: String,
16    pub is_admin: bool,
17    pub is_read_only: bool,
18}
19
20#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
21pub enum Relation {
22    #[sea_orm(has_many = "super::auth_token::Entity")]
23    AuthToken,
24    #[sea_orm(has_many = "super::crate_user::Entity")]
25    CrateUser,
26    #[sea_orm(has_many = "super::group_user::Entity")]
27    GroupUser,
28    #[sea_orm(has_many = "super::owner::Entity")]
29    Owner,
30    #[sea_orm(has_many = "super::session::Entity")]
31    Session,
32}
33
34impl Related<super::auth_token::Entity> for Entity {
35    fn to() -> RelationDef {
36        Relation::AuthToken.def()
37    }
38}
39
40impl Related<super::crate_user::Entity> for Entity {
41    fn to() -> RelationDef {
42        Relation::CrateUser.def()
43    }
44}
45
46impl Related<super::group_user::Entity> for Entity {
47    fn to() -> RelationDef {
48        Relation::GroupUser.def()
49    }
50}
51
52impl Related<super::owner::Entity> for Entity {
53    fn to() -> RelationDef {
54        Relation::Owner.def()
55    }
56}
57
58impl Related<super::session::Entity> for Entity {
59    fn to() -> RelationDef {
60        Relation::Session.def()
61    }
62}
63
64impl ActiveModelBehavior for ActiveModel {}