view models
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import { TeamJoinRequestViewModel, type TeamJoinRequestDTO } from '@/lib/view-models/TeamJoinRequestViewModel';
|
||||
import type { TeamsApiClient } from '../../api/teams/TeamsApiClient';
|
||||
import { TeamJoinRequestViewModel } from '../../view-models';
|
||||
|
||||
type TeamJoinRequestDTO = {
|
||||
id: string;
|
||||
teamId: string;
|
||||
driverId: string;
|
||||
requestedAt: string;
|
||||
message?: string;
|
||||
// TODO: Create generated DTO when API spec is available
|
||||
type TeamJoinRequestsDto = {
|
||||
requests: TeamJoinRequestDTO[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -24,14 +21,14 @@ export class TeamJoinService {
|
||||
* Get team join requests with view model transformation
|
||||
*/
|
||||
async getJoinRequests(teamId: string, currentUserId: string, isOwner: boolean): Promise<TeamJoinRequestViewModel[]> {
|
||||
const dto = await this.apiClient.getJoinRequests(teamId);
|
||||
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(teamId: string, requestId: string): Promise<void> {
|
||||
async approveJoinRequest(): Promise<void> {
|
||||
// TODO: implement API call when endpoint is available
|
||||
throw new Error('Not implemented: API endpoint for approving join requests');
|
||||
}
|
||||
@@ -39,7 +36,7 @@ export class TeamJoinService {
|
||||
/**
|
||||
* Reject a team join request
|
||||
*/
|
||||
async rejectJoinRequest(teamId: string, requestId: string): Promise<void> {
|
||||
async rejectJoinRequest(): Promise<void> {
|
||||
// TODO: implement API call when endpoint is available
|
||||
throw new Error('Not implemented: API endpoint for rejecting join requests');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user