view models
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import { RaceListItemDto } from '../dtos';
|
||||
// Note: No generated DTO available for RaceListItem yet
|
||||
interface RaceListItemDTO {
|
||||
id: string;
|
||||
name: string;
|
||||
leagueId: string;
|
||||
leagueName: string;
|
||||
scheduledTime: string;
|
||||
status: string;
|
||||
trackName?: string;
|
||||
}
|
||||
|
||||
export class RaceListItemViewModel implements RaceListItemDto {
|
||||
export class RaceListItemViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
leagueId: string;
|
||||
@@ -9,8 +18,14 @@ export class RaceListItemViewModel implements RaceListItemDto {
|
||||
status: string;
|
||||
trackName?: string;
|
||||
|
||||
constructor(dto: RaceListItemDto) {
|
||||
Object.assign(this, dto);
|
||||
constructor(dto: RaceListItemDTO) {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
this.leagueId = dto.leagueId;
|
||||
this.leagueName = dto.leagueName;
|
||||
this.scheduledTime = dto.scheduledTime;
|
||||
this.status = dto.status;
|
||||
if (dto.trackName !== undefined) this.trackName = dto.trackName;
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted scheduled time */
|
||||
|
||||
Reference in New Issue
Block a user