refactor page to use services
This commit is contained in:
@@ -7,29 +7,27 @@ import { ProtestDTO } from '../types/generated/ProtestDTO';
|
||||
export class ProtestViewModel {
|
||||
id: string;
|
||||
raceId: string;
|
||||
complainantId: string;
|
||||
defendantId: string;
|
||||
protestingDriverId: string;
|
||||
accusedDriverId: string;
|
||||
description: string;
|
||||
status: string;
|
||||
createdAt: string;
|
||||
submittedAt: string;
|
||||
|
||||
constructor(dto: ProtestDTO) {
|
||||
this.id = dto.id;
|
||||
this.raceId = dto.raceId;
|
||||
this.complainantId = dto.complainantId;
|
||||
this.defendantId = dto.defendantId;
|
||||
this.protestingDriverId = dto.protestingDriverId;
|
||||
this.accusedDriverId = dto.accusedDriverId;
|
||||
this.description = dto.description;
|
||||
this.status = dto.status;
|
||||
this.createdAt = dto.createdAt;
|
||||
this.submittedAt = dto.submittedAt;
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted created date */
|
||||
get formattedCreatedAt(): string {
|
||||
return new Date(this.createdAt).toLocaleString();
|
||||
/** UI-specific: Formatted submitted date */
|
||||
get formattedSubmittedAt(): string {
|
||||
return new Date(this.submittedAt).toLocaleString();
|
||||
}
|
||||
|
||||
/** UI-specific: Status display */
|
||||
/** UI-specific: Status display - placeholder since status not in current DTO */
|
||||
get statusDisplay(): string {
|
||||
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
|
||||
return 'Pending'; // TODO: Update when status is added to DTO
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user