resolve todos in core
This commit is contained in:
@@ -4,7 +4,7 @@ import type { IDriverStatsService } from '../../domain/services/IDriverStatsServ
|
||||
import type { GetDriverAvatarInputPort } from '../ports/input/GetDriverAvatarInputPort';
|
||||
import type { GetDriverAvatarOutputPort } from '../ports/output/GetDriverAvatarOutputPort';
|
||||
import type { DriversLeaderboardOutputPort, DriverLeaderboardItemOutputPort } from '../ports/output/DriversLeaderboardOutputPort';
|
||||
import type { SkillLevel } from '../../domain/services/SkillLevelService';
|
||||
import { SkillLevelService, type SkillLevel } from '../../domain/services/SkillLevelService';
|
||||
import type { AsyncUseCase, Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
@@ -40,17 +40,20 @@ export class GetDriversLeaderboardUseCase
|
||||
const driverItems: DriverLeaderboardItemOutputPort[] = drivers.map(driver => {
|
||||
const ranking = rankings.find(r => r.driverId === driver.id);
|
||||
const stats = this.driverStatsService.getDriverStats(driver.id);
|
||||
const rating = ranking?.rating ?? 0;
|
||||
const racesCompleted = stats?.totalRaces ?? 0;
|
||||
const skillLevel: SkillLevel = SkillLevelService.getSkillLevel(rating);
|
||||
|
||||
return {
|
||||
id: driver.id,
|
||||
name: driver.name.value,
|
||||
rating: ranking?.rating ?? 0,
|
||||
skillLevel: 'Pro' as SkillLevel, // TODO: map from domain
|
||||
rating,
|
||||
skillLevel,
|
||||
nationality: driver.country.value,
|
||||
racesCompleted: stats?.totalRaces ?? 0,
|
||||
racesCompleted,
|
||||
wins: stats?.wins ?? 0,
|
||||
podiums: stats?.podiums ?? 0,
|
||||
isActive: true, // TODO: determine from domain
|
||||
isActive: racesCompleted > 0,
|
||||
rank: ranking?.overallRank ?? 0,
|
||||
avatarUrl: avatarUrls[driver.id],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user