fix issues in core
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import type { IFeedRepository } from '@core/social/domain/repositories/IFeedRepository';
|
||||
import type { ISocialGraphRepository } from '@core/social/domain/repositories/ISocialGraphRepository';
|
||||
import type { FeedItem } from '@core/social/domain/types/FeedItem';
|
||||
@@ -14,6 +15,7 @@ import type { IRaceRegistrationRepository } from '../../domain/repositories/IRac
|
||||
import type { IRaceRepository } from '../../domain/repositories/IRaceRepository';
|
||||
import type { IResultRepository } from '../../domain/repositories/IResultRepository';
|
||||
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
|
||||
import type { Result as RaceResult } from '../../domain/entities/result/Result';
|
||||
|
||||
export interface DashboardOverviewInput {
|
||||
driverId: string;
|
||||
@@ -48,7 +50,7 @@ export interface DashboardRaceSummary {
|
||||
export interface DashboardRecentRaceResultSummary {
|
||||
race: Race;
|
||||
league: League | null;
|
||||
result: Result;
|
||||
result: RaceResult;
|
||||
}
|
||||
|
||||
export interface DashboardLeagueStandingSummary {
|
||||
@@ -95,13 +97,14 @@ export class DashboardOverviewUseCase {
|
||||
private readonly getDriverStats: (
|
||||
driverId: string,
|
||||
) => DashboardDriverStatsAdapter | null,
|
||||
private readonly output: UseCaseOutputPort<DashboardOverviewResult>,
|
||||
) {}
|
||||
|
||||
async execute(
|
||||
input: DashboardOverviewInput,
|
||||
): Promise<
|
||||
Result<
|
||||
DashboardOverviewResult,
|
||||
void,
|
||||
ApplicationErrorCode<'DRIVER_NOT_FOUND' | 'REPOSITORY_ERROR', { message: string }>
|
||||
>
|
||||
> {
|
||||
@@ -206,7 +209,9 @@ export class DashboardOverviewUseCase {
|
||||
friends: friendsSummary,
|
||||
};
|
||||
|
||||
return Result.ok(result);
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
} catch (error) {
|
||||
return Result.err({
|
||||
code: 'REPOSITORY_ERROR',
|
||||
|
||||
Reference in New Issue
Block a user