This commit is contained in:
2025-12-10 18:28:32 +01:00
parent 6d61be9c51
commit 1303a14493
108 changed files with 3366 additions and 1559 deletions

View File

@@ -1,18 +1,22 @@
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import type { StandingDTO } from '../dto/StandingDTO';
import { EntityMappers } from '../mappers/EntityMappers';
import type { ILeagueStandingsPresenter } from '../presenters/ILeagueStandingsPresenter';
export interface GetLeagueStandingsQueryParamsDTO {
export interface GetLeagueStandingsUseCaseParams {
leagueId: string;
}
export class GetLeagueStandingsQuery {
/**
* 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: GetLeagueStandingsQueryParamsDTO): Promise<StandingDTO[]> {
async execute(params: GetLeagueStandingsUseCaseParams): Promise<void> {
const standings = await this.standingRepository.findByLeagueId(params.leagueId);
return EntityMappers.toStandingDTOs(standings);
this.presenter.present(standings);
}
}