module cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
|
||||
import type { UpdateLeagueMemberRoleResultDTO } from '../presenters/IUpdateLeagueMemberRolePresenter';
|
||||
|
||||
export interface UpdateLeagueMemberRoleUseCaseParams {
|
||||
leagueId: string;
|
||||
@@ -11,7 +12,7 @@ export interface UpdateLeagueMemberRoleUseCaseParams {
|
||||
export class UpdateLeagueMemberRoleUseCase {
|
||||
constructor(private readonly leagueMembershipRepository: ILeagueMembershipRepository) {}
|
||||
|
||||
async execute(params: UpdateLeagueMemberRoleUseCaseParams): Promise<Result<void, ApplicationErrorCode<'MEMBERSHIP_NOT_FOUND'>>> {
|
||||
async execute(params: UpdateLeagueMemberRoleUseCaseParams): Promise<Result<UpdateLeagueMemberRoleResultDTO, ApplicationErrorCode<'MEMBERSHIP_NOT_FOUND'>>> {
|
||||
const memberships = await this.leagueMembershipRepository.getLeagueMembers(params.leagueId);
|
||||
const membership = memberships.find(m => m.driverId === params.targetDriverId);
|
||||
if (!membership) {
|
||||
@@ -21,6 +22,6 @@ export class UpdateLeagueMemberRoleUseCase {
|
||||
...membership,
|
||||
role: params.newRole,
|
||||
});
|
||||
return Result.ok(undefined);
|
||||
return Result.ok({ success: true });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user