website cleanup
This commit is contained in:
@@ -2,7 +2,11 @@ import { ProtestsApiClient } from '../../api/protests/ProtestsApiClient';
|
||||
import { ProtestViewModel } from '../../view-models/ProtestViewModel';
|
||||
import { RaceViewModel } from '../../view-models/RaceViewModel';
|
||||
import { ProtestDriverViewModel } from '../../view-models/ProtestDriverViewModel';
|
||||
import type { LeagueAdminProtestsDTO, ApplyPenaltyCommandDTO, RequestProtestDefenseCommandDTO, DriverSummaryDTO } from '../../types';
|
||||
import type { LeagueAdminProtestsDTO } from '../../types/generated/LeagueAdminProtestsDTO';
|
||||
import type { ApplyPenaltyCommandDTO } from '../../types/generated/ApplyPenaltyCommandDTO';
|
||||
import type { RequestProtestDefenseCommandDTO } from '../../types/generated/RequestProtestDefenseCommandDTO';
|
||||
import type { ReviewProtestCommandDTO } from '../../types/generated/ReviewProtestCommandDTO';
|
||||
import type { DriverDTO } from '../../types/generated/DriverDTO';
|
||||
|
||||
/**
|
||||
* Protest Service
|
||||
@@ -45,8 +49,11 @@ export class ProtestService {
|
||||
if (!protest) return null;
|
||||
|
||||
const race = Object.values(dto.racesById)[0];
|
||||
const protestingDriver = dto.driversById[protest.protestingDriverId];
|
||||
const accusedDriver = dto.driversById[protest.accusedDriverId];
|
||||
|
||||
// Cast to the correct type for indexing
|
||||
const driversById = dto.driversById as unknown as Record<string, DriverDTO>;
|
||||
const protestingDriver = driversById[protest.protestingDriverId];
|
||||
const accusedDriver = driversById[protest.accusedDriverId];
|
||||
|
||||
return {
|
||||
protest: new ProtestViewModel(protest),
|
||||
@@ -74,7 +81,14 @@ export class ProtestService {
|
||||
* Review protest
|
||||
*/
|
||||
async reviewProtest(input: { protestId: string; stewardId: string; decision: string; decisionNotes: string }): Promise<void> {
|
||||
await this.apiClient.reviewProtest(input);
|
||||
const command: ReviewProtestCommandDTO = {
|
||||
protestId: input.protestId,
|
||||
stewardId: input.stewardId,
|
||||
enum: input.decision === 'uphold' ? 'uphold' : 'dismiss',
|
||||
decision: input.decision,
|
||||
decisionNotes: input.decisionNotes
|
||||
};
|
||||
await this.apiClient.reviewProtest(command);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user