sea_orm/rbac/entity/
role_hierarchy.rs1use crate as sea_orm;
2use sea_orm::entity::prelude::*;
3
4use super::role::RoleId;
5
6#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, DeriveEntityModel)]
7#[sea_orm(table_name = "sea_orm_role_hierarchy")]
8pub struct Model {
9 #[sea_orm(primary_key)]
10 pub super_role_id: RoleId,
11 #[sea_orm(primary_key)]
12 pub role_id: RoleId,
13}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17 #[sea_orm(
18 belongs_to = "super::role::Entity",
19 from = "Column::RoleId",
20 to = "super::role::Column::Id"
21 )]
22 Role,
23 #[sea_orm(
24 belongs_to = "super::role::Entity",
25 from = "Column::SuperRoleId",
26 to = "super::role::Column::Id"
27 )]
28 SuperRole,
29}
30
31impl ActiveModelBehavior for ActiveModel {}