use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, serde::Serialize, serde::Deserialize)]
#[sea_orm(table_name = "eihwaz_droits")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: crate::utils::pk::Pk,
#[sea_orm(unique)]
pub resource_key: String,
pub can_create: bool,
pub can_read: bool,
pub can_update: bool,
pub can_delete: bool,
pub can_update_own: bool,
pub can_delete_own: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn after_delete<C>(self, _db: &C) -> Result<Self, DbErr>
where
C: ConnectionTrait,
{
crate::auth::permissions_cache::clear_cache();
Ok(self)
}
}