import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository'; import type { IGetLeagueAdminPresenter, GetLeagueAdminResultDTO, GetLeagueAdminViewModel } from '../presenters/IGetLeagueAdminPresenter'; import type { UseCase } from '@core/shared/application/UseCase'; export interface GetLeagueAdminUseCaseParams { leagueId: string; } export interface GetLeagueAdminResultDTO { league: { id: string; ownerId: string; }; // Additional data would be populated by combining multiple use cases } export class GetLeagueAdminUseCase implements UseCase { constructor( private readonly leagueRepository: ILeagueRepository, ) {} async execute(params: GetLeagueAdminUseCaseParams, presenter: IGetLeagueAdminPresenter): Promise { const league = await this.leagueRepository.findById(params.leagueId); if (!league) { throw new Error('League not found'); } const dto: GetLeagueAdminResultDTO = { league: { id: league.id, ownerId: league.ownerId, }, }; presenter.reset(); presenter.present(dto); } }