league service
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user