24 lines
674 B
TypeScript
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;
|
|
}
|
|
} |