wip league admin tools
This commit is contained in:
@@ -24,10 +24,13 @@ export class GetAllRacesPresenter implements UseCaseOutputPort<GetAllRacesResult
|
||||
track: race.track,
|
||||
car: race.car,
|
||||
scheduledAt: race.scheduledAt.toISOString(),
|
||||
status: race.status,
|
||||
status: race.status.toString(),
|
||||
leagueId: race.leagueId,
|
||||
leagueName: leagueMap.get(race.leagueId) ?? 'Unknown League',
|
||||
strengthOfField: race.strengthOfField ?? null,
|
||||
strengthOfField:
|
||||
typeof race.strengthOfField === 'number'
|
||||
? race.strengthOfField
|
||||
: race.strengthOfField?.toNumber() ?? null,
|
||||
})),
|
||||
filters: {
|
||||
statuses: [
|
||||
|
||||
@@ -42,9 +42,13 @@ export class RaceDetailPresenter implements UseCaseOutputPort<GetRaceDetailResul
|
||||
scheduledAt: output.race.scheduledAt.toISOString(),
|
||||
sessionType: output.race.sessionType.toString(),
|
||||
status: output.race.status.toString(),
|
||||
strengthOfField: output.race.strengthOfField ?? null,
|
||||
...(output.race.registeredCount !== undefined && { registeredCount: output.race.registeredCount }),
|
||||
...(output.race.maxParticipants !== undefined && { maxParticipants: output.race.maxParticipants }),
|
||||
strengthOfField: output.race.strengthOfField?.toNumber() ?? null,
|
||||
...(output.race.registeredCount !== undefined && {
|
||||
registeredCount: output.race.registeredCount.toNumber(),
|
||||
}),
|
||||
...(output.race.maxParticipants !== undefined && {
|
||||
maxParticipants: output.race.maxParticipants.toNumber(),
|
||||
}),
|
||||
}
|
||||
: null;
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ export class RacesPageDataPresenter {
|
||||
track: race.track,
|
||||
car: race.car,
|
||||
scheduledAt: race.scheduledAt.toISOString(),
|
||||
status: race.status,
|
||||
status: race.status.toString(),
|
||||
leagueId: race.leagueId,
|
||||
leagueName,
|
||||
strengthOfField: race.strengthOfField ?? null,
|
||||
strengthOfField: race.strengthOfField?.toNumber() ?? null,
|
||||
isUpcoming: race.scheduledAt > new Date(),
|
||||
isLive: race.status === 'running',
|
||||
isPast: race.scheduledAt < new Date() && race.status === 'completed',
|
||||
isLive: race.status.isRunning(),
|
||||
isPast: race.scheduledAt < new Date() && race.status.isCompleted(),
|
||||
}));
|
||||
|
||||
this.model = { races } as RacesPageDataDTO;
|
||||
|
||||
Reference in New Issue
Block a user