Files
gridpilot.gg/packages/racing/application/use-cases/GetLeagueStandingsUseCase.ts
2025-12-11 00:57:32 +01:00

22 lines
769 B
TypeScript

import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import type { ILeagueStandingsPresenter } from '../presenters/ILeagueStandingsPresenter';
export interface GetLeagueStandingsUseCaseParams {
leagueId: string;
}
/**
* Use Case for retrieving league standings.
* Orchestrates domain logic and delegates presentation to the presenter.
*/
export class GetLeagueStandingsUseCase {
constructor(
private readonly standingRepository: IStandingRepository,
public readonly presenter: ILeagueStandingsPresenter,
) {}
async execute(params: GetLeagueStandingsUseCaseParams): Promise<void> {
const standings = await this.standingRepository.findByLeagueId(params.leagueId);
this.presenter.present(standings);
}
}