fix presenter issues

This commit is contained in:
2025-12-27 01:39:18 +01:00
parent 9a74e16f11
commit 901fb1ac83
9 changed files with 65 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
import type { Logger, UseCase } from '@core/shared/application';
import type { Logger, UseCase, 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';
@@ -42,20 +42,21 @@ export type GetDriversLeaderboardErrorCode =
* Use Case for retrieving driver leaderboard data.
* Returns a Result containing the domain leaderboard model.
*/
export class GetDriversLeaderboardUseCase implements UseCase<GetDriversLeaderboardInput, GetDriversLeaderboardResult, GetDriversLeaderboardErrorCode> {
export class GetDriversLeaderboardUseCase implements UseCase<GetDriversLeaderboardInput, void, GetDriversLeaderboardErrorCode> {
constructor(
private readonly driverRepository: IDriverRepository,
private readonly rankingService: IRankingService,
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 }>
>
> {
@@ -105,7 +106,9 @@ export class GetDriversLeaderboardUseCase implements UseCase<GetDriversLeaderboa
this.logger.debug('Successfully computed drivers leaderboard');
return Result.ok(result);
this.output.present(result);
return Result.ok(void 0);
} catch (error) {
const err = error instanceof Error ? error : new Error(String(error));