Files
imphnen-backend-service/imphnen-dimentorin/src/materials/domain/repository.rs
T

24 lines
833 B
Rust
Raw Normal View History

use async_trait::async_trait;
use paginator_utils::PaginatorResponse;
use uuid::Uuid;
use super::material::MaterialEntity;
use imphnen_utils::AppError;
#[async_trait]
pub trait MaterialRepository: Send + Sync {
async fn find_all_paginated(
&self,
page: u64,
per_page: u64,
category: Option<String>,
published_only: bool,
) -> Result<PaginatorResponse<MaterialEntity>, AppError>;
async fn find_by_id(&self, id: Uuid) -> Result<MaterialEntity, AppError>;
async fn find_by_slug(&self, slug: &str) -> Result<MaterialEntity, AppError>;
async fn find_categories(&self) -> Result<Vec<String>, AppError>;
async fn create(&self, entity: MaterialEntity) -> Result<Uuid, AppError>;
async fn update(&self, id: Uuid, entity: MaterialEntity) -> Result<(), AppError>;
async fn delete(&self, id: Uuid) -> Result<(), AppError>;
}