refactor core presenters
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user