35 lines
883 B
TypeScript
35 lines
883 B
TypeScript
import { ProtestDTO } from '../types/generated/ProtestDTO';
|
|
|
|
/**
|
|
* Protest view model
|
|
* Represents a race protest
|
|
*/
|
|
export class ProtestViewModel implements ProtestDTO {
|
|
id: string;
|
|
raceId: string;
|
|
complainantId: string;
|
|
defendantId: string;
|
|
description: string;
|
|
status: string;
|
|
createdAt: string;
|
|
|
|
constructor(dto: ProtestDTO) {
|
|
this.id = dto.id;
|
|
this.raceId = dto.raceId;
|
|
this.complainantId = dto.complainantId;
|
|
this.defendantId = dto.defendantId;
|
|
this.description = dto.description;
|
|
this.status = dto.status;
|
|
this.createdAt = dto.createdAt;
|
|
}
|
|
|
|
/** UI-specific: Formatted created date */
|
|
get formattedCreatedAt(): string {
|
|
return new Date(this.createdAt).toLocaleString();
|
|
}
|
|
|
|
/** UI-specific: Status display */
|
|
get statusDisplay(): string {
|
|
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
|
|
}
|
|
} |