refactor
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user