49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import type {
|
|
IRaceWithSOFPresenter,
|
|
RaceWithSOFViewModel,
|
|
} from '@gridpilot/racing/application/presenters/IRaceWithSOFPresenter';
|
|
|
|
export class RaceWithSOFPresenter implements IRaceWithSOFPresenter {
|
|
private viewModel: RaceWithSOFViewModel | null = null;
|
|
|
|
present(
|
|
raceId: string,
|
|
leagueId: string,
|
|
scheduledAt: Date,
|
|
track: string,
|
|
trackId: string,
|
|
car: string,
|
|
carId: string,
|
|
sessionType: string,
|
|
status: string,
|
|
strengthOfField: number | null,
|
|
registeredCount: number,
|
|
maxParticipants: number,
|
|
participantCount: number
|
|
): RaceWithSOFViewModel {
|
|
this.viewModel = {
|
|
id: raceId,
|
|
leagueId,
|
|
scheduledAt: scheduledAt.toISOString(),
|
|
track,
|
|
trackId,
|
|
car,
|
|
carId,
|
|
sessionType,
|
|
status,
|
|
strengthOfField,
|
|
registeredCount,
|
|
maxParticipants,
|
|
participantCount,
|
|
};
|
|
|
|
return this.viewModel;
|
|
}
|
|
|
|
getViewModel(): RaceWithSOFViewModel {
|
|
if (!this.viewModel) {
|
|
throw new Error('Presenter has not been called yet');
|
|
}
|
|
return this.viewModel;
|
|
}
|
|
} |