league service

This commit is contained in:
2025-12-16 00:57:31 +01:00
parent 3b566c973d
commit 775d41e055
130 changed files with 4077 additions and 1036 deletions

View File

@@ -0,0 +1,23 @@
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
import type { IRejectLeagueJoinRequestPresenter, RejectLeagueJoinRequestResultDTO, RejectLeagueJoinRequestViewModel } from '../presenters/IRejectLeagueJoinRequestPresenter';
import type { UseCase } from '@gridpilot/shared/application/UseCase';
export interface RejectLeagueJoinRequestUseCaseParams {
requestId: string;
}
export interface RejectLeagueJoinRequestResultDTO {
success: boolean;
message: string;
}
export class RejectLeagueJoinRequestUseCase implements UseCase<RejectLeagueJoinRequestUseCaseParams, RejectLeagueJoinRequestResultDTO, RejectLeagueJoinRequestViewModel, IRejectLeagueJoinRequestPresenter> {
constructor(private readonly leagueMembershipRepository: ILeagueMembershipRepository) {}
async execute(params: RejectLeagueJoinRequestUseCaseParams, presenter: IRejectLeagueJoinRequestPresenter): Promise<void> {
await this.leagueMembershipRepository.removeJoinRequest(params.requestId);
const dto: RejectLeagueJoinRequestResultDTO = { success: true, message: 'Join request rejected.' };
presenter.reset();
presenter.present(dto);
}
}