2026-04-02 13:39:52 +07:00
|
|
|
use super::mentor::MentorEntity;
|
2026-04-02 22:29:08 +07:00
|
|
|
use super::mentor_types::{
|
|
|
|
|
MentorDetail, MentorListPage, MentorRegisterCommand, MentorRegistered,
|
|
|
|
|
MentorUpdateCommand, MentorVerifyCommand,
|
2026-04-02 13:39:52 +07:00
|
|
|
};
|
2026-04-02 22:29:08 +07:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
use imphnen_utils::AppError;
|
|
|
|
|
use paginator_rs::PaginationParams;
|
|
|
|
|
use uuid::Uuid;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait MentorService: Send + Sync {
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn list(&self, params: PaginationParams)
|
|
|
|
|
-> Result<MentorListPage, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn get_by_id(&self, id: Uuid) -> Result<MentorDetail, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn get_by_email(&self, email: &str) -> Result<MentorDetail, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn register(
|
|
|
|
|
&self,
|
|
|
|
|
cmd: MentorRegisterCommand,
|
|
|
|
|
) -> Result<MentorRegistered, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn update(
|
|
|
|
|
&self,
|
|
|
|
|
id: Uuid,
|
|
|
|
|
cmd: MentorUpdateCommand,
|
|
|
|
|
) -> Result<MentorDetail, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn update_me(
|
|
|
|
|
&self,
|
|
|
|
|
email: &str,
|
|
|
|
|
cmd: MentorUpdateCommand,
|
|
|
|
|
) -> Result<MentorDetail, 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 verify(
|
|
|
|
|
&self,
|
|
|
|
|
id: Uuid,
|
|
|
|
|
cmd: MentorVerifyCommand,
|
|
|
|
|
) -> Result<MentorDetail, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn get_status(&self, email: &str) -> Result<String, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn get_entity_by_id(
|
|
|
|
|
&self,
|
|
|
|
|
id: Uuid,
|
|
|
|
|
include_deleted: bool,
|
|
|
|
|
) -> Result<MentorEntity, AppError>;
|
2026-04-02 13:39:52 +07:00
|
|
|
}
|