fix issues
This commit is contained in:
@@ -57,11 +57,11 @@ export class DashboardRaceSummaryViewModel {
|
||||
}
|
||||
|
||||
get leagueId(): string {
|
||||
return this.dto.leagueId;
|
||||
return (this.dto as any).leagueId ?? '';
|
||||
}
|
||||
|
||||
get leagueName(): string {
|
||||
return this.dto.leagueName;
|
||||
return (this.dto as any).leagueName ?? '';
|
||||
}
|
||||
|
||||
get track(): string {
|
||||
@@ -166,38 +166,52 @@ export class DashboardOverviewViewModel {
|
||||
|
||||
get currentDriver(): DashboardDriverSummaryViewModel {
|
||||
// DTO uses optional property; enforce a consistent object for the UI
|
||||
return new DashboardDriverSummaryViewModel(this.dto.currentDriver ?? {
|
||||
id: '',
|
||||
name: '',
|
||||
country: '',
|
||||
avatarUrl: '',
|
||||
totalRaces: 0,
|
||||
wins: 0,
|
||||
podiums: 0,
|
||||
});
|
||||
return new DashboardDriverSummaryViewModel(
|
||||
(this.dto as any).currentDriver ?? {
|
||||
id: '',
|
||||
name: '',
|
||||
country: '',
|
||||
avatarUrl: '',
|
||||
totalRaces: 0,
|
||||
wins: 0,
|
||||
podiums: 0,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
get nextRace(): DashboardRaceSummaryViewModel | null {
|
||||
return this.dto.nextRace ? new DashboardRaceSummaryViewModel(this.dto.nextRace) : null;
|
||||
const nextRace = (this.dto as any).nextRace;
|
||||
return nextRace ? new DashboardRaceSummaryViewModel(nextRace) : null;
|
||||
}
|
||||
|
||||
get upcomingRaces(): DashboardRaceSummaryViewModel[] {
|
||||
return this.dto.upcomingRaces.map((r) => new DashboardRaceSummaryViewModel(r));
|
||||
const upcomingRaces = (this.dto as any).upcomingRaces ?? [];
|
||||
return upcomingRaces.map((r: any) => new DashboardRaceSummaryViewModel(r));
|
||||
}
|
||||
|
||||
get leagueStandings(): DashboardLeagueStandingSummaryViewModel[] {
|
||||
return this.dto.leagueStandingsSummaries.map((s) => new DashboardLeagueStandingSummaryViewModel(s));
|
||||
const leagueStandings = (this.dto as any).leagueStandingsSummaries ?? (this.dto as any).leagueStandings ?? [];
|
||||
return leagueStandings.map((s: any) => new DashboardLeagueStandingSummaryViewModel(s));
|
||||
}
|
||||
|
||||
get feedItems(): DashboardFeedItemSummaryViewModel[] {
|
||||
return this.dto.feedSummary.items.map((i) => new DashboardFeedItemSummaryViewModel(i));
|
||||
const feedItems = (this.dto as any).feedSummary?.items ?? (this.dto as any).feedItems ?? [];
|
||||
return feedItems.map((i: any) => new DashboardFeedItemSummaryViewModel(i));
|
||||
}
|
||||
|
||||
get friends(): DashboardFriendSummaryViewModel[] {
|
||||
return this.dto.friends.map((f) => new DashboardFriendSummaryViewModel(f));
|
||||
const friends = (this.dto as any).friends ?? [];
|
||||
return friends.map((f: any) => new DashboardFriendSummaryViewModel(f));
|
||||
}
|
||||
|
||||
get activeLeaguesCount(): number {
|
||||
return this.dto.activeLeaguesCount;
|
||||
return (this.dto as any).activeLeaguesCount ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
DashboardDriverSummaryViewModel as DriverViewModel,
|
||||
DashboardRaceSummaryViewModel as RaceViewModel,
|
||||
DashboardLeagueStandingSummaryViewModel as LeagueStandingViewModel,
|
||||
DashboardFriendSummaryViewModel as FriendViewModel,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user