refactor dtos to ports
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import type { IDriverRepository } from '../../domain/repositories/IDriverRepository';
|
||||
import type { IRankingService } from '../../domain/services/IRankingService';
|
||||
import type { IDriverStatsService } from '../../domain/services/IDriverStatsService';
|
||||
import type { IImageServicePort } from '../ports/IImageServicePort';
|
||||
import type { GetDriverAvatarInputPort } from '../ports/input/GetDriverAvatarInputPort';
|
||||
import type { GetDriverAvatarOutputPort } from '../ports/output/GetDriverAvatarOutputPort';
|
||||
import type { DriversLeaderboardResultDTO } from '../presenters/IDriversLeaderboardPresenter';
|
||||
import type { AsyncUseCase, Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
@@ -18,7 +19,7 @@ export class GetDriversLeaderboardUseCase
|
||||
private readonly driverRepository: IDriverRepository,
|
||||
private readonly rankingService: IRankingService,
|
||||
private readonly driverStatsService: IDriverStatsService,
|
||||
private readonly imageService: IImageServicePort,
|
||||
private readonly getDriverAvatar: (input: GetDriverAvatarInputPort) => Promise<GetDriverAvatarOutputPort>,
|
||||
private readonly logger: Logger,
|
||||
) {}
|
||||
|
||||
@@ -36,7 +37,9 @@ export class GetDriversLeaderboardUseCase
|
||||
if (driverStats) {
|
||||
stats[driver.id] = driverStats;
|
||||
}
|
||||
avatarUrls[driver.id] = this.imageService.getDriverAvatar(driver.id);
|
||||
|
||||
const avatarResult = await this.getDriverAvatar({ driverId: driver.id });
|
||||
avatarUrls[driver.id] = avatarResult.avatarUrl;
|
||||
}
|
||||
|
||||
const dto: DriversLeaderboardResultDTO = {
|
||||
|
||||
Reference in New Issue
Block a user