1use 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 #[sea_orm(column_type = "Text")]
19 pub created: String,
20}
21
22#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
23pub enum Relation {
24 #[sea_orm(has_many = "super::auth_token::Entity")]
25 AuthToken,
26 #[sea_orm(has_many = "super::crate_user::Entity")]
27 CrateUser,
28 #[sea_orm(has_many = "super::group_user::Entity")]
29 GroupUser,
30 #[sea_orm(has_many = "super::oauth2_identity::Entity")]
31 OAuth2Identity,
32 #[sea_orm(has_many = "super::owner::Entity")]
33 Owner,
34 #[sea_orm(has_many = "super::session::Entity")]
35 Session,
36}
37
38impl Related<super::auth_token::Entity> for Entity {
39 fn to() -> RelationDef {
40 Relation::AuthToken.def()
41 }
42}
43
44impl Related<super::crate_user::Entity> for Entity {
45 fn to() -> RelationDef {
46 Relation::CrateUser.def()
47 }
48}
49
50impl Related<super::group_user::Entity> for Entity {
51 fn to() -> RelationDef {
52 Relation::GroupUser.def()
53 }
54}
55
56impl Related<super::oauth2_identity::Entity> for Entity {
57 fn to() -> RelationDef {
58 Relation::OAuth2Identity.def()
59 }
60}
61
62impl Related<super::owner::Entity> for Entity {
63 fn to() -> RelationDef {
64 Relation::Owner.def()
65 }
66}
67
68impl Related<super::session::Entity> for Entity {
69 fn to() -> RelationDef {
70 Relation::Session.def()
71 }
72}
73
74impl ActiveModelBehavior for ActiveModel {}