Files
imphnen-backend-service/imphnen-dimentorin/src/materials/domain/repository.rs
T
asepharyana ac8177d87e feat(dimentorin): materials module (CRUD konten mentoring, public+protected routes)
- app_materials table: mentor_id, title, slug, category, description, content
- domain/application/infrastructure pola articles: repo postgres, service, DTO ZodValidate
- routes: GET /materials (public, published only), GET /materials/{id|slug|categories}, POST/PUT/DELETE (auth, author-only)
- verified e2e: create 3 materi sebagai mentor, list, slug, categories
2026-08-05 17:01:59 +07:00

24 lines
833 B
Rust

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>;
}