jet/crates/entities/src/auth_permission.rs

51 lines
1.4 KiB
Rust
Raw Normal View History

2024-01-23 12:29:19 +01:00
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.11
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "auth_permission")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
pub content_type_id: i32,
pub codename: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
2024-02-10 11:03:40 +01:00
pub enum Relation {
#[sea_orm(has_many = "super::auth_group_permissions::Entity")]
AuthGroupPermissions,
#[sea_orm(
belongs_to = "super::django_content_type::Entity",
from = "Column::ContentTypeId",
to = "super::django_content_type::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
DjangoContentType,
#[sea_orm(has_many = "super::users_user_permissions::Entity")]
UsersUserPermissions,
}
impl Related<super::auth_group_permissions::Entity> for Entity {
fn to() -> RelationDef {
Relation::AuthGroupPermissions.def()
}
}
impl Related<super::django_content_type::Entity> for Entity {
fn to() -> RelationDef {
Relation::DjangoContentType.def()
}
}
impl Related<super::users_user_permissions::Entity> for Entity {
fn to() -> RelationDef {
Relation::UsersUserPermissions.def()
}
}
2024-01-23 12:29:19 +01:00
impl ActiveModelBehavior for ActiveModel {}