code quality

This commit is contained in:
2026-01-26 17:47:37 +01:00
parent 9ac74f5046
commit 3a4f460a7d
21 changed files with 121 additions and 58 deletions

View File

@@ -2,7 +2,7 @@ import { ViewModel } from "../contracts/view-models/ViewModel";
import { ProfileViewData } from "../view-data/ProfileViewData";
import { DriverProfileDriverSummaryViewModel } from "./DriverProfileDriverSummaryViewModel";
export { DriverProfileDriverSummaryViewModel as DriverProfileSocialSummaryViewModel };
export { DriverProfileDriverSummaryViewModel };
export interface DriverProfileStatsViewModel extends ViewModel {
totalRaces: number;

View File

@@ -9,16 +9,16 @@ import type { DriverSummaryData } from "../view-data/DriverSummaryData";
* Client-only UI helper built from ViewData.
*/
export class DriverSummaryViewModel extends ViewModel {
constructor(private readonly viewData: DriverSummaryData) {
constructor(private readonly viewData: any) {
super();
}
get id(): string {
return this.viewData.driverId;
return this.viewData.driverId || this.viewData.id;
}
get name(): string {
return this.viewData.driverName;
return this.viewData.driverName || this.viewData.name;
}
get avatarUrl(): string | null {

View File

@@ -2,6 +2,8 @@ import { ViewModel } from "../contracts/view-models/ViewModel";
import type { LeagueScheduleViewData } from "../view-data/LeagueScheduleViewData";
import { LeagueScheduleRaceViewModel } from "./LeagueScheduleRaceViewModel";
export { LeagueScheduleRaceViewModel };
export class LeagueScheduleViewModel extends ViewModel {
readonly races: LeagueScheduleRaceViewModel[];

View File

@@ -1,5 +1,7 @@
import { ViewModel } from "../contracts/view-models/ViewModel";
import type { CustomPointsConfig, ScoringConfigurationViewData } from "../view-data/ScoringConfigurationViewData";
export type { CustomPointsConfig };
import { LeagueScoringPresetViewModel } from './LeagueScoringPresetViewModel';
export class ScoringConfigurationViewModel extends ViewModel {

View File

@@ -15,14 +15,14 @@ export class TeamSummaryViewModel extends ViewModel {
get tag(): string { return this.data.tag; }
get memberCount(): number { return this.data.memberCount; }
get description(): string | undefined { return this.data.description; }
get totalWins(): number { return this.data.totalWins; }
get totalRaces(): number { return this.data.totalRaces; }
get performanceLevel(): string { return this.data.performanceLevel; }
get totalWins(): number { return this.data.totalWins || 0; }
get totalRaces(): number { return this.data.totalRaces || 0; }
get performanceLevel(): string { return this.data.performanceLevel || 'beginner'; }
get isRecruiting(): boolean { return this.data.isRecruiting; }
get specialization(): string | undefined { return this.data.specialization; }
get region(): string | undefined { return this.data.region; }
get languages(): string[] { return this.data.languages; }
get leagues(): string[] { return this.data.leagues; }
get languages(): string[] { return this.data.languages || []; }
get leagues(): string[] { return this.data.leagues || []; }
get logoUrl(): string | undefined { return this.data.logoUrl; }
get rating(): number | undefined { return this.data.rating; }
get category(): string | undefined { return this.data.category; }