refactor use cases
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
import type { ISponsorshipPricingRepository } from '../../domain/repositories/ISponsorshipPricingRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { SponsorableEntityType } from '../../domain/entities/SponsorshipRequest';
|
||||
@@ -42,16 +41,13 @@ export type GetEntitySponsorshipPricingErrorCode =
|
||||
| 'REPOSITORY_ERROR';
|
||||
|
||||
export class GetEntitySponsorshipPricingUseCase {
|
||||
constructor(
|
||||
private readonly sponsorshipPricingRepo: ISponsorshipPricingRepository,
|
||||
private readonly logger: Logger,
|
||||
private readonly output: UseCaseOutputPort<GetEntitySponsorshipPricingResult>,
|
||||
) {}
|
||||
constructor(private readonly sponsorshipPricingRepo: ISponsorshipPricingRepository,
|
||||
private readonly logger: Logger) {}
|
||||
|
||||
async execute(
|
||||
input: GetEntitySponsorshipPricingInput,
|
||||
): Promise<
|
||||
Result<void, ApplicationErrorCode<GetEntitySponsorshipPricingErrorCode, { message: string }>>
|
||||
Result<GetEntitySponsorshipPricingResult, ApplicationErrorCode<GetEntitySponsorshipPricingErrorCode, { message: string }>>
|
||||
> {
|
||||
this.logger.debug(
|
||||
`Executing GetEntitySponsorshipPricingUseCase for entityType: ${input.entityType}, entityId: ${input.entityId}`,
|
||||
@@ -107,9 +103,7 @@ export class GetEntitySponsorshipPricingUseCase {
|
||||
this.logger.info(
|
||||
`Successfully retrieved sponsorship pricing for entityType: ${input.entityType}, entityId: ${input.entityId}`,
|
||||
);
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
'Error executing GetEntitySponsorshipPricingUseCase',
|
||||
|
||||
Reference in New Issue
Block a user