2026-04-02 22:29:08 +07:00
|
|
|
use super::session::SessionEntity;
|
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;
|
|
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait SessionRepository: Send + Sync {
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn create(&self, entity: SessionEntity) -> Result<SessionEntity, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_by_id(&self, id: Uuid) -> Result<Option<SessionEntity>, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_by_mentor_id(
|
|
|
|
|
&self,
|
|
|
|
|
mentor_id: Uuid,
|
|
|
|
|
status_filter: Option<String>,
|
|
|
|
|
) -> Result<Vec<SessionEntity>, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_by_mentee_id(
|
|
|
|
|
&self,
|
|
|
|
|
mentee_id: Uuid,
|
|
|
|
|
status_filter: Option<String>,
|
|
|
|
|
) -> Result<Vec<SessionEntity>, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_booked_dates(
|
|
|
|
|
&self,
|
|
|
|
|
mentor_id: Uuid,
|
|
|
|
|
) -> Result<Vec<String>, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn update(
|
|
|
|
|
&self,
|
|
|
|
|
id: Uuid,
|
|
|
|
|
entity: SessionEntity,
|
|
|
|
|
) -> Result<SessionEntity, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn delete(&self, id: Uuid) -> Result<(), AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn count_by_mentor(
|
|
|
|
|
&self,
|
|
|
|
|
mentor_id: Uuid,
|
|
|
|
|
status_filter: Option<String>,
|
|
|
|
|
) -> Result<usize, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn count_by_mentee(
|
|
|
|
|
&self,
|
|
|
|
|
mentee_id: Uuid,
|
|
|
|
|
status_filter: Option<String>,
|
|
|
|
|
) -> Result<usize, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn find_all_paginated(
|
|
|
|
|
&self,
|
|
|
|
|
params: PaginationParams,
|
|
|
|
|
) -> Result<PaginatorResponse<SessionEntity>, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
}
|