refactor use cases
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Logger , UseCaseOutputPort } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { IFeedRepository } from '../../domain/repositories/IFeedRepository';
|
||||
@@ -26,12 +26,11 @@ export class GetUserFeedUseCase {
|
||||
constructor(
|
||||
private readonly feedRepository: IFeedRepository,
|
||||
private readonly logger: Logger,
|
||||
private readonly output: UseCaseOutputPort<GetUserFeedResult>,
|
||||
) {}
|
||||
|
||||
async execute(
|
||||
input: GetUserFeedInput,
|
||||
): Promise<Result<void, GetUserFeedApplicationError>> {
|
||||
): Promise<Result<GetUserFeedResult, GetUserFeedApplicationError>> {
|
||||
const { driverId, limit } = input;
|
||||
this.logger.debug('GetUserFeedUseCase.execute started', { driverId, limit });
|
||||
|
||||
@@ -51,9 +50,7 @@ export class GetUserFeedUseCase {
|
||||
items,
|
||||
};
|
||||
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
} catch (error) {
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user