18 lines
629 B
TypeScript
18 lines
629 B
TypeScript
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
|
|
import type { StandingDTO } from '../dto/StandingDTO';
|
|
import { EntityMappers } from '../mappers/EntityMappers';
|
|
|
|
export interface GetLeagueStandingsQueryParamsDTO {
|
|
leagueId: string;
|
|
}
|
|
|
|
export class GetLeagueStandingsQuery {
|
|
constructor(
|
|
private readonly standingRepository: IStandingRepository,
|
|
) {}
|
|
|
|
async execute(params: GetLeagueStandingsQueryParamsDTO): Promise<StandingDTO[]> {
|
|
const standings = await this.standingRepository.findByLeagueId(params.leagueId);
|
|
return EntityMappers.toStandingDTOs(standings);
|
|
}
|
|
} |