website refactor
This commit is contained in:
@@ -8,7 +8,7 @@ export class LeagueDetailViewModel {
|
||||
drivers: DriverViewModel[];
|
||||
races: RaceViewModel[];
|
||||
|
||||
constructor(data: { league: any; drivers: any[]; races: any[] }) {
|
||||
constructor(data: { league: unknown; drivers: unknown[]; races: unknown[] }) {
|
||||
this.league = new LeagueViewModel(data.league);
|
||||
this.drivers = data.drivers.map(driver => new DriverViewModel(driver));
|
||||
this.races = data.races.map(race => new RaceViewModel(race));
|
||||
@@ -37,24 +37,26 @@ export class LeagueViewModel {
|
||||
secondary: { available: number; total: number; price: number; benefits: string[] };
|
||||
};
|
||||
|
||||
constructor(data: any) {
|
||||
this.id = data.id;
|
||||
this.name = data.name;
|
||||
this.game = data.game;
|
||||
this.tier = data.tier;
|
||||
this.season = data.season;
|
||||
this.description = data.description;
|
||||
this.drivers = data.drivers;
|
||||
this.races = data.races;
|
||||
this.completedRaces = data.completedRaces;
|
||||
this.totalImpressions = data.totalImpressions;
|
||||
this.avgViewsPerRace = data.avgViewsPerRace;
|
||||
this.engagement = data.engagement;
|
||||
this.rating = data.rating;
|
||||
this.seasonStatus = data.seasonStatus;
|
||||
this.seasonDates = data.seasonDates;
|
||||
this.nextRace = data.nextRace;
|
||||
this.sponsorSlots = data.sponsorSlots;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.id = d.id;
|
||||
this.name = d.name;
|
||||
this.game = d.game;
|
||||
this.tier = d.tier;
|
||||
this.season = d.season;
|
||||
this.description = d.description;
|
||||
this.drivers = d.drivers;
|
||||
this.races = d.races;
|
||||
this.completedRaces = d.completedRaces;
|
||||
this.totalImpressions = d.totalImpressions;
|
||||
this.avgViewsPerRace = d.avgViewsPerRace;
|
||||
this.engagement = d.engagement;
|
||||
this.rating = d.rating;
|
||||
this.seasonStatus = d.seasonStatus;
|
||||
this.seasonDates = d.seasonDates;
|
||||
this.nextRace = d.nextRace;
|
||||
this.sponsorSlots = d.sponsorSlots;
|
||||
}
|
||||
|
||||
get formattedTotalImpressions(): string {
|
||||
@@ -104,14 +106,16 @@ export class DriverViewModel {
|
||||
impressions: number;
|
||||
team: string;
|
||||
|
||||
constructor(data: any) {
|
||||
this.id = data.id;
|
||||
this.name = data.name;
|
||||
this.country = data.country;
|
||||
this.position = data.position;
|
||||
this.races = data.races;
|
||||
this.impressions = data.impressions;
|
||||
this.team = data.team;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.id = d.id;
|
||||
this.name = d.name;
|
||||
this.country = d.country;
|
||||
this.position = d.position;
|
||||
this.races = d.races;
|
||||
this.impressions = d.impressions;
|
||||
this.team = d.team;
|
||||
}
|
||||
|
||||
get formattedImpressions(): string {
|
||||
@@ -126,12 +130,14 @@ export class RaceViewModel {
|
||||
views: number;
|
||||
status: 'upcoming' | 'completed';
|
||||
|
||||
constructor(data: any) {
|
||||
this.id = data.id;
|
||||
this.name = data.name;
|
||||
this.date = new Date(data.date);
|
||||
this.views = data.views;
|
||||
this.status = data.status;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.id = d.id;
|
||||
this.name = d.name;
|
||||
this.date = new Date(d.date);
|
||||
this.views = d.views;
|
||||
this.status = d.status;
|
||||
}
|
||||
|
||||
get formattedDate(): string {
|
||||
|
||||
Reference in New Issue
Block a user