wip
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user