view models
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { RaceResultDto } from '../dtos';
|
||||
import { RaceResultDTO } from '../types/generated/RaceResultDTO';
|
||||
|
||||
export class RaceResultViewModel implements RaceResultDto {
|
||||
id: string;
|
||||
raceId: string;
|
||||
export class RaceResultViewModel implements RaceResultDTO {
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
avatarUrl: string;
|
||||
@@ -14,7 +12,7 @@ export class RaceResultViewModel implements RaceResultDto {
|
||||
isPodium: boolean;
|
||||
isClean: boolean;
|
||||
|
||||
constructor(dto: RaceResultDto) {
|
||||
constructor(dto: RaceResultDTO) {
|
||||
Object.assign(this, dto);
|
||||
}
|
||||
|
||||
@@ -63,8 +61,8 @@ export class RaceResultViewModel implements RaceResultDto {
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}.${milliseconds.toString().padStart(3, '0')}`;
|
||||
}
|
||||
|
||||
/** Compatibility with old DTO interface */
|
||||
getPositionChange(): number {
|
||||
return this.positionChange;
|
||||
}
|
||||
// Note: The generated DTO doesn't have id or raceId
|
||||
// These will need to be added when the OpenAPI spec is updated
|
||||
id: string = '';
|
||||
raceId: string = '';
|
||||
}
|
||||
Reference in New Issue
Block a user