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';
@@ -50,12 +50,11 @@ export class ImportRaceResultsUseCase {
private readonly driverRepository: IDriverRepository,
private readonly standingRepository: IStandingRepository,
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<ImportRaceResultsResult>,
) {}
async execute(
input: ImportRaceResultsInput,
): Promise<Result<void, ApplicationErrorCode<ImportRaceResultsErrorCode, { message: string }>>> {
): Promise<Result<ImportRaceResultsResult, ApplicationErrorCode<ImportRaceResultsErrorCode, { message: string }>>> {
const { raceId, rows } = input;
this.logger.debug('ImportRaceResultsUseCase:execute', { raceId });
@@ -168,9 +167,7 @@ export class ImportRaceResultsUseCase {
errors: [],
};
this.output.present(result);
return Result.ok(undefined);
return Result.ok(result);
} catch (error: unknown) {
this.logger.error(
'ImportRaceResultsUseCase:execution error',
@@ -188,4 +185,4 @@ export class ImportRaceResultsUseCase {
});
}
}
}
}