refactor core presenters

This commit is contained in:
2025-12-19 19:42:19 +01:00
parent 8116fe888f
commit 94fc538f44
228 changed files with 2817 additions and 3097 deletions

View File

@@ -1,20 +1,17 @@
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { RemoveLeagueMemberOutputPort } from '../ports/output/RemoveLeagueMemberOutputPort';
export interface RemoveLeagueMemberUseCaseParams {
leagueId: string;
targetDriverId: string;
}
export interface RemoveLeagueMemberResultDTO {
success: boolean;
}
export class RemoveLeagueMemberUseCase {
constructor(private readonly leagueMembershipRepository: ILeagueMembershipRepository) {}
async execute(params: RemoveLeagueMemberUseCaseParams): Promise<Result<RemoveLeagueMemberResultDTO, ApplicationErrorCode<'MEMBERSHIP_NOT_FOUND'>>> {
async execute(params: RemoveLeagueMemberUseCaseParams): Promise<Result<RemoveLeagueMemberOutputPort, ApplicationErrorCode<'MEMBERSHIP_NOT_FOUND'>>> {
const memberships = await this.leagueMembershipRepository.getLeagueMembers(params.leagueId);
const membership = memberships.find(m => m.driverId === params.targetDriverId);
if (!membership) {