https://apifox.com/apidoc/shared-ceda7a60-e817-4ea8-827b-de4e874dc45e implement all backend API
48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "groups_permissions")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub group_id: i32,
|
|
pub permission_id: i32,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::groups::Entity",
|
|
from = "Column::GroupId",
|
|
to = "super::groups::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Groups,
|
|
#[sea_orm(
|
|
belongs_to = "super::permissions::Entity",
|
|
from = "Column::PermissionId",
|
|
to = "super::permissions::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Permissions,
|
|
}
|
|
|
|
impl Related<super::groups::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Groups.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::permissions::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Permissions.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|