Files
gridpilot.gg/apps/website/lib/presenters/RaceRegistrationsPresenter.ts
2025-12-10 18:28:32 +01:00

24 lines
674 B
TypeScript

import type {
IRaceRegistrationsPresenter,
RaceRegistrationsViewModel,
} from '@gridpilot/racing/application/presenters/IRaceRegistrationsPresenter';
export class RaceRegistrationsPresenter implements IRaceRegistrationsPresenter {
private viewModel: RaceRegistrationsViewModel | null = null;
present(registeredDriverIds: string[]): RaceRegistrationsViewModel {
this.viewModel = {
registeredDriverIds,
count: registeredDriverIds.length,
};
return this.viewModel;
}
getViewModel(): RaceRegistrationsViewModel {
if (!this.viewModel) {
throw new Error('Presenter has not been called yet');
}
return this.viewModel;
}
}