refactor use cases
This commit is contained in:
@@ -14,7 +14,6 @@ import { randomUUID } from 'crypto';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
|
||||
export interface ApplyPenaltyInput {
|
||||
raceId: string;
|
||||
@@ -38,14 +37,13 @@ export class ApplyPenaltyUseCase {
|
||||
private readonly raceRepository: IRaceRepository,
|
||||
private readonly leagueMembershipRepository: ILeagueMembershipRepository,
|
||||
private readonly logger: Logger,
|
||||
private readonly output: UseCaseOutputPort<ApplyPenaltyResult>,
|
||||
) {}
|
||||
|
||||
async execute(
|
||||
command: ApplyPenaltyInput,
|
||||
): Promise<
|
||||
Result<
|
||||
void,
|
||||
ApplyPenaltyResult,
|
||||
ApplicationErrorCode<
|
||||
| 'RACE_NOT_FOUND'
|
||||
| 'INSUFFICIENT_AUTHORITY'
|
||||
@@ -117,8 +115,7 @@ export class ApplyPenaltyUseCase {
|
||||
);
|
||||
|
||||
const result: ApplyPenaltyResult = { penaltyId: penalty.id };
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user