refactor use cases
This commit is contained in:
@@ -3,7 +3,6 @@ import type { ILeagueRepository } from '../../domain/repositories/ILeagueReposit
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { randomUUID } from 'crypto';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import { JoinedAt } from '../../domain/value-objects/JoinedAt';
|
||||
import { LeagueId } from '../../domain/entities/LeagueId';
|
||||
import { DriverId } from '../../domain/entities/DriverId';
|
||||
@@ -28,10 +27,9 @@ export class ApproveLeagueJoinRequestUseCase {
|
||||
|
||||
async execute(
|
||||
input: ApproveLeagueJoinRequestInput,
|
||||
output: UseCaseOutputPort<ApproveLeagueJoinRequestResult>,
|
||||
): Promise<
|
||||
Result<
|
||||
void,
|
||||
ApproveLeagueJoinRequestResult,
|
||||
ApplicationErrorCode<
|
||||
'JOIN_REQUEST_NOT_FOUND' | 'LEAGUE_NOT_FOUND' | 'LEAGUE_AT_CAPACITY',
|
||||
{ message: string }
|
||||
@@ -67,8 +65,7 @@ export class ApproveLeagueJoinRequestUseCase {
|
||||
});
|
||||
|
||||
const result: ApproveLeagueJoinRequestResult = { success: true, message: 'Join request approved.' };
|
||||
output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user