|
|
|
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
|
|
|
|
|
|
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
#[derive(
|
|
|
|
|
Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize, Default, sqlx :: FromRow,
|
|
|
|
|
)]
|
|
|
|
|
#[sea_orm(table_name = "app")]
|
|
|
|
|
pub struct Model {
|
|
|
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
|
|
|
pub id: String,
|
|
|
|
|
pub created: DateTime,
|
|
|
|
|
pub updated: DateTime,
|
|
|
|
|
#[sea_orm(column_name = "_key")]
|
|
|
|
|
#[serde(skip)]
|
|
|
|
|
pub key: String,
|
|
|
|
|
pub name: String,
|
|
|
|
|
pub icon: Option<String>,
|
|
|
|
|
#[sea_orm(column_type = "Text", nullable)]
|
|
|
|
|
pub des: Option<String>,
|
|
|
|
|
pub user_count: i32,
|
|
|
|
|
pub hide: i8,
|
|
|
|
|
pub join_method: i32,
|
|
|
|
|
pub role_id: Option<String>,
|
|
|
|
|
pub redirect: Option<String>,
|
|
|
|
|
pub status: i32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
|
|
pub enum Relation {
|
|
|
|
|
#[sea_orm(has_many = "super::app_user::Entity")]
|
|
|
|
|
AppUser,
|
|
|
|
|
#[sea_orm(has_many = "super::resource::Entity")]
|
|
|
|
|
Resource,
|
|
|
|
|
#[sea_orm(
|
|
|
|
|
belongs_to = "super::role::Entity",
|
|
|
|
|
from = "Column::RoleId",
|
|
|
|
|
to = "super::role::Column::Id",
|
|
|
|
|
on_update = "NoAction",
|
|
|
|
|
on_delete = "NoAction"
|
|
|
|
|
)]
|
|
|
|
|
Role,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::app_user::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::AppUser.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::resource::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::Resource.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::role::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::Role.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::access::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
super::resource::Relation::Access.def()
|
|
|
|
|
}
|
|
|
|
|
fn via() -> Option<RelationDef> {
|
|
|
|
|
Some(super::resource::Relation::App.def().rev())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::user::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
super::app_user::Relation::User.def()
|
|
|
|
|
}
|
|
|
|
|
fn via() -> Option<RelationDef> {
|
|
|
|
|
Some(super::app_user::Relation::App.def().rev())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|