34 lines
778 B
TypeScript
34 lines
778 B
TypeScript
import { RaceDTO } from '../types/generated/RaceDTO';
|
|
|
|
export class RaceViewModel {
|
|
constructor(private readonly dto: RaceDTO, private readonly _status?: string, private readonly _registeredCount?: number, private readonly _strengthOfField?: number) {}
|
|
|
|
get id(): string {
|
|
return this.dto.id;
|
|
}
|
|
|
|
get name(): string {
|
|
return this.dto.name;
|
|
}
|
|
|
|
get date(): string {
|
|
return this.dto.date;
|
|
}
|
|
|
|
get status(): string | undefined {
|
|
return this._status;
|
|
}
|
|
|
|
get registeredCount(): number | undefined {
|
|
return this._registeredCount;
|
|
}
|
|
|
|
get strengthOfField(): number | undefined {
|
|
return this._strengthOfField;
|
|
}
|
|
|
|
/** UI-specific: Formatted date */
|
|
get formattedDate(): string {
|
|
return new Date(this.date).toLocaleDateString();
|
|
}
|
|
} |