2026-04-02 15:15:00 +07:00
|
|
|
use super::entity::*;
|
2026-04-02 22:29:08 +07:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
use imphnen_utils::errors::AppError;
|
|
|
|
|
use uuid::Uuid;
|
2026-04-02 15:15:00 +07:00
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait TeamService: Send + Sync {
|
2026-04-02 22:29:08 +07:00
|
|
|
async fn create_team(
|
|
|
|
|
&self,
|
|
|
|
|
user_id: Uuid,
|
|
|
|
|
input: CreateTeamInput,
|
|
|
|
|
) -> Result<TeamWithDetails, AppError>;
|
|
|
|
|
async fn get_team_by_id(&self, team_id: Uuid)
|
|
|
|
|
-> Result<TeamWithDetails, AppError>;
|
|
|
|
|
async fn browse_teams(
|
|
|
|
|
&self,
|
|
|
|
|
input: BrowseTeamsInput,
|
|
|
|
|
) -> Result<BrowseTeamsResult, AppError>;
|
|
|
|
|
async fn get_user_teams(
|
|
|
|
|
&self,
|
|
|
|
|
user_id: Uuid,
|
|
|
|
|
) -> Result<Vec<TeamWithDetails>, AppError>;
|
|
|
|
|
async fn update_team(
|
|
|
|
|
&self,
|
|
|
|
|
team_id: Uuid,
|
|
|
|
|
user_id: Uuid,
|
|
|
|
|
input: UpdateTeamInput,
|
|
|
|
|
) -> Result<TeamWithDetails, AppError>;
|
|
|
|
|
async fn remove_team_member(
|
|
|
|
|
&self,
|
|
|
|
|
team_id: Uuid,
|
|
|
|
|
user_id: Uuid,
|
|
|
|
|
member_id: Uuid,
|
|
|
|
|
) -> Result<(), AppError>;
|
|
|
|
|
async fn leave_team(&self, team_id: Uuid, user_id: Uuid) -> Result<(), AppError>;
|
|
|
|
|
async fn delete_team(&self, team_id: Uuid, user_id: Uuid) -> Result<(), AppError>;
|
2026-04-02 15:15:00 +07:00
|
|
|
}
|