refactor use cases

This commit is contained in:
2026-01-08 15:34:51 +01:00
parent d984ab24a8
commit 52e9a2f6a7
362 changed files with 5192 additions and 8409 deletions

View File

@@ -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);
}
}