refactor
This commit is contained in:
@@ -52,7 +52,6 @@ export class GetEntityAnalyticsQuery
|
||||
private readonly pageViewRepository: IPageViewRepository,
|
||||
private readonly engagementRepository: IEngagementRepository,
|
||||
private readonly snapshotRepository: IAnalyticsSnapshotRepository,
|
||||
private readonly output: UseCaseOutputPort<Result<EntityAnalyticsOutput, ApplicationErrorCode<GetEntityAnalyticsErrorCode, { message: string }>>>,
|
||||
private readonly logger: Logger
|
||||
) {}
|
||||
|
||||
@@ -145,10 +144,8 @@ export class GetEntityAnalyticsQuery
|
||||
label: this.formatPeriodLabel(since, now),
|
||||
},
|
||||
};
|
||||
const result = Result.ok<EntityAnalyticsOutput, ApplicationErrorCode<GetEntityAnalyticsErrorCode, { message: string }>>(resultData);
|
||||
this.output.present(result);
|
||||
this.logger.info(`Successfully retrieved analytics for entity ${input.entityId}.`);
|
||||
return result;
|
||||
return Result.ok(resultData);
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
this.logger.error(`Failed to get entity analytics for ${input.entityId}: ${err.message}`, err);
|
||||
@@ -156,7 +153,6 @@ export class GetEntityAnalyticsQuery
|
||||
code: 'REPOSITORY_ERROR',
|
||||
details: { message: err.message ?? 'Failed to get entity analytics' },
|
||||
});
|
||||
this.output.present(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user