This commit is contained in:
2025-12-21 22:35:38 +01:00
parent 3c64f328e2
commit 9bd2e630e6
38 changed files with 736 additions and 684 deletions

View File

@@ -1,4 +1,4 @@
import type { Logger } from '@core/shared/application';
import type { Logger, UseCaseOutputPort } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { Driver } from '../../domain/entities/Driver';
@@ -49,13 +49,14 @@ export class GetDriversLeaderboardUseCase {
private readonly driverStatsService: IDriverStatsService,
private readonly getDriverAvatar: (driverId: string) => Promise<string | undefined>,
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<GetDriversLeaderboardResult>,
) {}
async execute(
input: GetDriversLeaderboardInput,
): Promise<
Result<
GetDriversLeaderboardResult,
void,
ApplicationErrorCode<GetDriversLeaderboardErrorCode, { message: string }>
>
> {
@@ -107,7 +108,9 @@ export class GetDriversLeaderboardUseCase {
this.logger.debug('Successfully computed drivers leaderboard');
return Result.ok(result);
this.output.present(result);
return Result.ok(undefined);
} catch (error) {
const err = error instanceof Error ? error : new Error(String(error));