From aa58c66f0e5c216439d307e7e327a57e923b060d Mon Sep 17 00:00:00 2001 From: Abdul Hakim Date: Tue, 20 Aug 2024 08:30:40 +0700 Subject: [PATCH] fixed get posts by profile endpoint --- src/enums/method-type.enum.ts | 1 + src/interceptors/pagination.interceptor.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/enums/method-type.enum.ts b/src/enums/method-type.enum.ts index d43782bec..ee58dc96e 100644 --- a/src/enums/method-type.enum.ts +++ b/src/enums/method-type.enum.ts @@ -28,4 +28,5 @@ export enum MethodType { UPDATEEXPERIENCE = 'updateExperience', UPDATEPRIMARY = 'updatePrimary', VERIFY = 'verify', + FINDBYPROFILE = 'findByProfile', } diff --git a/src/interceptors/pagination.interceptor.ts b/src/interceptors/pagination.interceptor.ts index 7de94b9fa..159ec2c6e 100644 --- a/src/interceptors/pagination.interceptor.ts +++ b/src/interceptors/pagination.interceptor.ts @@ -630,10 +630,12 @@ export class PaginationInterceptor implements Provider { } private initializeFilter(invocationCtx: InvocationContext): AnyObject { - const filter = - invocationCtx.args[0] && typeof invocationCtx.args[0] === 'object' - ? invocationCtx.args[0] - : {where: {}}; + const methodName = invocationCtx.methodName as MethodType; + const arg = + methodName === MethodType.FINDBYPROFILE + ? invocationCtx.args[1] + : invocationCtx.args[0]; + const filter = arg && typeof arg === 'object' ? arg : {where: {}}; filter.where = {...filter.where}; return filter; @@ -663,6 +665,10 @@ export class PaginationInterceptor implements Provider { return 1; } + if (methodName === MethodType.FINDBYPROFILE) { + return 1; + } + if (methodName === MethodType.GETIMPORTERS) return 2; return 0; }