Files
gridpilot.gg/apps/website/lib/presenters/LeagueStandingsPresenter.ts
2025-12-15 18:34:20 +01:00

25 lines
789 B
TypeScript

import { GetLeagueStandingsUseCase, LeagueStandingsViewModel } from '@gridpilot/core/league/application/use-cases/GetLeagueStandingsUseCase';
export interface ILeagueStandingsPresenter {
present(leagueId: string): Promise<void>;
getViewModel(): LeagueStandingsViewModel | null;
reset(): void;
}
export class LeagueStandingsPresenter implements ILeagueStandingsPresenter {
private viewModel: LeagueStandingsViewModel | null = null;
constructor(private getLeagueStandingsUseCase: GetLeagueStandingsUseCase) {}
reset(): void {
this.viewModel = null;
}
async present(leagueId: string): Promise<void> {
this.viewModel = await this.getLeagueStandingsUseCase.execute(leagueId);
}
getViewModel(): LeagueStandingsViewModel | null {
return this.viewModel;
}
}