refactor use cases
This commit is contained in:
@@ -12,7 +12,6 @@ import type { ILeagueMembershipRepository } from '../../domain/repositories/ILea
|
||||
import type { IRaceRepository } from '../../domain/repositories/IRaceRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import { Money } from '../../domain/value-objects/Money';
|
||||
|
||||
export interface GetSponsorDashboardInput {
|
||||
@@ -70,12 +69,11 @@ export class GetSponsorDashboardUseCase {
|
||||
private readonly leagueRepository: ILeagueRepository,
|
||||
private readonly leagueMembershipRepository: ILeagueMembershipRepository,
|
||||
private readonly raceRepository: IRaceRepository,
|
||||
private readonly output: UseCaseOutputPort<GetSponsorDashboardResult>,
|
||||
) {}
|
||||
|
||||
async execute(
|
||||
params: GetSponsorDashboardInput,
|
||||
): Promise<Result<void, ApplicationErrorCode<GetSponsorDashboardErrorCode, { message: string }>>> {
|
||||
): Promise<Result<GetSponsorDashboardResult, ApplicationErrorCode<GetSponsorDashboardErrorCode, { message: string }>>> {
|
||||
try {
|
||||
const { sponsorId } = params;
|
||||
|
||||
@@ -189,9 +187,7 @@ export class GetSponsorDashboardUseCase {
|
||||
},
|
||||
};
|
||||
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
} catch (err) {
|
||||
const error = err as { message?: string } | undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user