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

@@ -1,7 +1,6 @@
import type { IRaceRepository } from '../../domain/repositories/IRaceRepository';
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
import type { Logger } from '@core/shared/application';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { RaceStatusValue } from '../../domain/entities/Race';
@@ -36,12 +35,11 @@ export class GetAllRacesPageDataUseCase {
private readonly raceRepository: IRaceRepository,
private readonly leagueRepository: ILeagueRepository,
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<GetAllRacesPageDataResult>,
) {}
async execute(
_input: GetAllRacesPageDataInput,
): Promise<Result<void, ApplicationErrorCode<GetAllRacesPageDataErrorCode, { message: string }>>> {
): Promise<Result<GetAllRacesPageDataResult, ApplicationErrorCode<GetAllRacesPageDataErrorCode, { message: string }>>> {
void _input;
this.logger.debug('Executing GetAllRacesPageDataUseCase');
try {
@@ -89,9 +87,7 @@ export class GetAllRacesPageDataUseCase {
};
this.logger.debug('Successfully retrieved all races page data.');
this.output.present(result);
return Result.ok(undefined);
return Result.ok(result);
} catch (error) {
this.logger.error(
'Error executing GetAllRacesPageDataUseCase',
@@ -103,4 +99,4 @@ export class GetAllRacesPageDataUseCase {
});
}
}
}
}