40 lines
1020 B
TypeScript
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';
|
|
}
|
|
} |