view data fixes
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
interface ImportRaceResultsSummaryDTO {
|
||||
success: boolean;
|
||||
raceId: string;
|
||||
driversProcessed: number;
|
||||
resultsRecorded: number;
|
||||
errors?: string[];
|
||||
}
|
||||
|
||||
import { ViewModel } from "../contracts/view-models/ViewModel";
|
||||
import type { ImportRaceResultsSummaryViewData } from "../view-data/ImportRaceResultsSummaryViewData";
|
||||
|
||||
export class ImportRaceResultsSummaryViewModel extends ViewModel {
|
||||
success: boolean;
|
||||
raceId: string;
|
||||
driversProcessed: number;
|
||||
resultsRecorded: number;
|
||||
errors: string[];
|
||||
constructor(private readonly viewData: ImportRaceResultsSummaryViewData) {
|
||||
super();
|
||||
}
|
||||
|
||||
constructor(dto: ImportRaceResultsSummaryDTO) {
|
||||
this.success = dto.success;
|
||||
this.raceId = dto.raceId;
|
||||
this.driversProcessed = dto.driversProcessed;
|
||||
this.resultsRecorded = dto.resultsRecorded;
|
||||
this.errors = dto.errors || [];
|
||||
get success(): boolean {
|
||||
return this.viewData.success;
|
||||
}
|
||||
|
||||
get raceId(): string {
|
||||
return this.viewData.raceId;
|
||||
}
|
||||
|
||||
get driversProcessed(): number {
|
||||
return this.viewData.driversProcessed;
|
||||
}
|
||||
|
||||
get resultsRecorded(): number {
|
||||
return this.viewData.resultsRecorded;
|
||||
}
|
||||
|
||||
get errors(): string[] {
|
||||
return this.viewData.errors;
|
||||
}
|
||||
|
||||
get hasErrors(): boolean {
|
||||
return this.errors.length > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user