2026-04-02 22:29:08 +07:00
|
|
|
use super::role::RoleEntity;
|
2026-04-02 13:39:52 +07:00
|
|
|
use async_trait::async_trait;
|
2026-04-02 22:29:08 +07:00
|
|
|
use imphnen_utils::AppError;
|
2026-04-02 13:39:52 +07:00
|
|
|
use paginator_rs::PaginationParams;
|
|
|
|
|
use paginator_utils::PaginatorResponse;
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait RoleRepository: Send + Sync {
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_all(
|
|
|
|
|
&self,
|
|
|
|
|
params: PaginationParams,
|
|
|
|
|
) -> Result<PaginatorResponse<RoleEntity>, AppError>;
|
|
|
|
|
async fn find_by_id(&self, id: String) -> Result<RoleEntity, AppError>;
|
|
|
|
|
async fn find_by_name(&self, name: String) -> Result<RoleEntity, AppError>;
|
|
|
|
|
async fn create(&self, entity: RoleEntity) -> Result<RoleEntity, AppError>;
|
|
|
|
|
async fn update(
|
|
|
|
|
&self,
|
|
|
|
|
id: String,
|
|
|
|
|
name: Option<String>,
|
|
|
|
|
permissions: Option<Vec<String>>,
|
|
|
|
|
) -> Result<String, AppError>;
|
|
|
|
|
async fn delete(&self, id: String) -> Result<String, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
}
|