refactor
This commit is contained in:
@@ -96,25 +96,20 @@ export class RaceService {
|
||||
async getAllRaces(): Promise<GetAllRacesPresenter> {
|
||||
this.logger.debug('[RaceService] Fetching all races.');
|
||||
|
||||
const result = await this.getAllRacesUseCase.execute();
|
||||
|
||||
if (result.isErr()) {
|
||||
throw new Error('Failed to get all races');
|
||||
}
|
||||
|
||||
const result = await this.getAllRacesUseCase.execute({});
|
||||
|
||||
const presenter = new GetAllRacesPresenter();
|
||||
await presenter.present(result.unwrap());
|
||||
presenter.reset();
|
||||
presenter.present(result);
|
||||
|
||||
return presenter;
|
||||
}
|
||||
|
||||
async getTotalRaces(): Promise<GetTotalRacesPresenter> {
|
||||
this.logger.debug('[RaceService] Fetching total races count.');
|
||||
const result = await this.getTotalRacesUseCase.execute();
|
||||
if (result.isErr()) {
|
||||
throw new Error(result.unwrapErr().code);
|
||||
}
|
||||
const result = await this.getTotalRacesUseCase.execute({});
|
||||
const presenter = new GetTotalRacesPresenter();
|
||||
presenter.present(result.unwrap());
|
||||
presenter.present(result);
|
||||
return presenter;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user