import { TeamJoinRequestViewModel, type TeamJoinRequestDTO } from '@/lib/view-models/TeamJoinRequestViewModel'; import type { TeamsApiClient } from '../../api/teams/TeamsApiClient'; // TODO: Create generated DTO when API spec is available type TeamJoinRequestsDto = { requests: TeamJoinRequestDTO[]; }; /** * Team Join Service * * Orchestrates team join/leave operations by coordinating API calls and view model creation. * All dependencies are injected via constructor. */ export class TeamJoinService { constructor( private readonly apiClient: TeamsApiClient ) {} /** * Get team join requests with view model transformation */ async getJoinRequests(teamId: string, currentUserId: string, isOwner: boolean): Promise { const dto = await this.apiClient.getJoinRequests(teamId) as TeamJoinRequestsDto; return dto.requests.map((r: TeamJoinRequestDTO) => new TeamJoinRequestViewModel(r, currentUserId, isOwner)); } /** * Approve a team join request */ async approveJoinRequest(): Promise { // TODO: implement API call when endpoint is available throw new Error('Not implemented: API endpoint for approving join requests'); } /** * Reject a team join request */ async rejectJoinRequest(): Promise { // TODO: implement API call when endpoint is available throw new Error('Not implemented: API endpoint for rejecting join requests'); } }