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

@@ -4,7 +4,7 @@ import type { IResultRepository } from '../../domain/repositories/IResultReposit
import type { IDriverRepository } from '../../domain/repositories/IDriverRepository';
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import { Result as RaceResult } from '../../domain/entities/result/Result';
import type { Logger, UseCaseOutputPort } from '@core/shared/application';
import type { Logger } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
@@ -53,12 +53,11 @@ export class ImportRaceResultsApiUseCase {
private readonly driverRepository: IDriverRepository,
private readonly standingRepository: IStandingRepository,
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<ImportRaceResultsApiResult>,
) {}
async execute(
input: ImportRaceResultsApiInput,
): Promise<Result<void, ApplicationErrorCode<ImportRaceResultsApiErrorCode, { message: string }>>> {
): Promise<Result<ImportRaceResultsApiResult, ApplicationErrorCode<ImportRaceResultsApiErrorCode, { message: string }>>> {
const { raceId, resultsFileContent } = input;
this.logger.debug('ImportRaceResultsApiUseCase:execute', { raceId });
@@ -187,9 +186,7 @@ export class ImportRaceResultsApiUseCase {
errors: [],
};
this.output.present(result);
return Result.ok(undefined);
return Result.ok(result);
} catch (error: unknown) {
this.logger.error(
'ImportRaceResultsApiUseCase:execution error',