refactor league module (wip)
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
import { LeagueStatsOutputPort } from '@core/racing/application/ports/output/LeagueStatsOutputPort';
|
||||
import type { GetLeagueStatsResult } from '@core/racing/application/use-cases/GetLeagueStatsUseCase';
|
||||
import { LeagueStatsDTO } from '../dtos/LeagueStatsDTO';
|
||||
import type { Presenter } from '@core/shared/presentation';
|
||||
|
||||
export class LeagueStatsPresenter implements Presenter<LeagueStatsOutputPort, LeagueStatsDTO> {
|
||||
export class LeagueStatsPresenter implements Presenter<GetLeagueStatsResult, LeagueStatsDTO> {
|
||||
private result: LeagueStatsDTO | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: LeagueStatsOutputPort) {
|
||||
this.result = dto;
|
||||
present(dto: GetLeagueStatsResult) {
|
||||
this.result = {
|
||||
totalMembers: dto.driverCount,
|
||||
totalRaces: dto.raceCount,
|
||||
averageRating: dto.averageRating,
|
||||
};
|
||||
}
|
||||
|
||||
getViewModel(): LeagueStatsDTO | null {
|
||||
getResponseModel(): LeagueStatsDTO | null {
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user