view data fixes
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 5m54s
Contract Testing / contract-snapshot (pull_request) Has been skipped

This commit is contained in:
2026-01-23 13:04:05 +01:00
parent d97f50ed72
commit e22033be38
24 changed files with 605 additions and 455 deletions

View File

@@ -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;
}
}