fix issues

This commit is contained in:
2025-12-26 11:49:20 +01:00
parent d08ec10b40
commit 68ae9da22a
44 changed files with 505 additions and 179 deletions

View File

@@ -49,12 +49,15 @@ export class ProtestService {
if (!protest) return null;
const race = Object.values(dto.racesById)[0];
if (!race) return null;
// 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];
if (!protestingDriver || !accusedDriver) return null;
return {
protest: new ProtestViewModel(protest),
race: new RaceViewModel(race),
@@ -81,13 +84,18 @@ export class ProtestService {
* Review protest
*/
async reviewProtest(input: { protestId: string; stewardId: string; decision: string; decisionNotes: string }): Promise<void> {
const normalizedDecision = input.decision.toLowerCase();
const enumValue: ReviewProtestCommandDTO['enum'] =
normalizedDecision === 'uphold' || normalizedDecision === 'upheld' ? 'uphold' : 'dismiss';
const command: ReviewProtestCommandDTO = {
protestId: input.protestId,
stewardId: input.stewardId,
enum: input.decision === 'uphold' ? 'uphold' : 'dismiss',
enum: enumValue,
decision: input.decision,
decisionNotes: input.decisionNotes
decisionNotes: input.decisionNotes,
};
await this.apiClient.reviewProtest(command);
}