22 lines
769 B
TypeScript
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);
|
|
}
|
|
} |