Files
gridpilot.gg/apps/website/lib/view-models/ProtestViewModel.ts
2025-12-18 19:14:50 +01:00

40 lines
1020 B
TypeScript

import { ProtestDTO } from '../types/generated/ProtestDTO';
/**
* Protest view model
* Represents a race protest
*/
export class ProtestViewModel {
id: string;
raceId: string;
protestingDriverId: string;
accusedDriverId: string;
description: string;
submittedAt: string;
status: string;
reviewedAt?: string;
decisionNotes?: string;
constructor(dto: ProtestDTO) {
this.id = dto.id;
this.raceId = dto.raceId;
this.protestingDriverId = dto.protestingDriverId;
this.accusedDriverId = dto.accusedDriverId;
this.description = dto.description;
this.submittedAt = dto.submittedAt;
// TODO: Add these fields to DTO when available
this.status = 'pending';
this.reviewedAt = undefined;
this.decisionNotes = undefined;
}
/** UI-specific: Formatted submitted date */
get formattedSubmittedAt(): string {
return new Date(this.submittedAt).toLocaleString();
}
/** UI-specific: Status display */
get statusDisplay(): string {
return 'Pending';
}
}