Files
gridpilot.gg/apps/website/lib/services/protests/ProtestService.ts
2026-01-14 02:02:24 +01:00

41 lines
1.6 KiB
TypeScript

import { ProtestsApiClient } from '@/lib/api/protests/ProtestsApiClient';
import type { ProtestViewModel } from '@/lib/view-models/ProtestViewModel';
import type { RaceViewModel } from '@/lib/view-models/RaceViewModel';
import type { ProtestDriverViewModel } from '@/lib/view-models/ProtestDriverViewModel';
import type { ApplyPenaltyCommandDTO } from '@/lib/types/generated/ApplyPenaltyCommandDTO';
import type { RequestProtestDefenseCommandDTO } from '@/lib/types/generated/RequestProtestDefenseCommandDTO';
import type { ReviewProtestCommandDTO } from '@/lib/types/generated/ReviewProtestCommandDTO';
/**
* Protest Service - DTO Only
*
* Returns raw API DTOs. No ViewModels or UX logic.
* All client-side presentation logic must be handled by hooks/components.
*/
export class ProtestService {
constructor(private readonly apiClient: ProtestsApiClient) {}
async getLeagueProtests(leagueId: string): Promise<any> {
return this.apiClient.getLeagueProtests(leagueId);
}
async getProtestById(leagueId: string, protestId: string): Promise<any> {
return this.apiClient.getLeagueProtest(leagueId, protestId);
}
async applyPenalty(input: ApplyPenaltyCommandDTO): Promise<void> {
return this.apiClient.applyPenalty(input);
}
async requestDefense(input: RequestProtestDefenseCommandDTO): Promise<void> {
return this.apiClient.requestDefense(input);
}
async reviewProtest(input: ReviewProtestCommandDTO): Promise<void> {
return this.apiClient.reviewProtest(input);
}
async findByRaceId(raceId: string): Promise<any> {
return this.apiClient.getRaceProtests(raceId);
}
}