25 lines
794 B
TypeScript
25 lines
794 B
TypeScript
import type { LeagueScoringPresetDTO } from '@gridpilot/racing/application/ports/LeagueScoringPresetProvider';
|
|
import type {
|
|
ILeagueScoringPresetsPresenter,
|
|
LeagueScoringPresetsViewModel,
|
|
} from '@gridpilot/racing/application/presenters/ILeagueScoringPresetsPresenter';
|
|
|
|
export class LeagueScoringPresetsPresenter implements ILeagueScoringPresetsPresenter {
|
|
private viewModel: LeagueScoringPresetsViewModel | null = null;
|
|
|
|
present(presets: LeagueScoringPresetDTO[]): LeagueScoringPresetsViewModel {
|
|
this.viewModel = {
|
|
presets,
|
|
totalCount: presets.length,
|
|
};
|
|
|
|
return this.viewModel;
|
|
}
|
|
|
|
getViewModel(): LeagueScoringPresetsViewModel {
|
|
if (!this.viewModel) {
|
|
throw new Error('Presenter has not been called yet');
|
|
}
|
|
return this.viewModel;
|
|
}
|
|
} |