module cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
|
||||
import type { IRejectLeagueJoinRequestPresenter, RejectLeagueJoinRequestResultDTO, RejectLeagueJoinRequestViewModel } from '../presenters/IRejectLeagueJoinRequestPresenter';
|
||||
import type { UseCase } from '@core/shared/application/UseCase';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { AsyncUseCase } from '@core/shared/application';
|
||||
|
||||
export interface RejectLeagueJoinRequestUseCaseParams {
|
||||
requestId: string;
|
||||
@@ -11,13 +12,12 @@ export interface RejectLeagueJoinRequestResultDTO {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export class RejectLeagueJoinRequestUseCase implements UseCase<RejectLeagueJoinRequestUseCaseParams, RejectLeagueJoinRequestResultDTO, RejectLeagueJoinRequestViewModel, IRejectLeagueJoinRequestPresenter> {
|
||||
export class RejectLeagueJoinRequestUseCase implements AsyncUseCase<RejectLeagueJoinRequestUseCaseParams, RejectLeagueJoinRequestResultDTO, 'NO_ERROR'> {
|
||||
constructor(private readonly leagueMembershipRepository: ILeagueMembershipRepository) {}
|
||||
|
||||
async execute(params: RejectLeagueJoinRequestUseCaseParams, presenter: IRejectLeagueJoinRequestPresenter): Promise<void> {
|
||||
async execute(params: RejectLeagueJoinRequestUseCaseParams): Promise<Result<RejectLeagueJoinRequestResultDTO, ApplicationErrorCode<'NO_ERROR'>>> {
|
||||
await this.leagueMembershipRepository.removeJoinRequest(params.requestId);
|
||||
const dto: RejectLeagueJoinRequestResultDTO = { success: true, message: 'Join request rejected.' };
|
||||
presenter.reset();
|
||||
presenter.present(dto);
|
||||
return Result.ok(dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user