Skip to content

Commit

Permalink
fixed get posts by profile endpoint (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhakim2902 authored Aug 20, 2024
1 parent 25b8cb5 commit 2a42f27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/enums/method-type.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export enum MethodType {
UPDATEEXPERIENCE = 'updateExperience',
UPDATEPRIMARY = 'updatePrimary',
VERIFY = 'verify',
FINDBYPROFILE = 'findByProfile',
}
14 changes: 10 additions & 4 deletions src/interceptors/pagination.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,12 @@ export class PaginationInterceptor implements Provider<Interceptor> {
}

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;
Expand Down Expand Up @@ -663,6 +665,10 @@ export class PaginationInterceptor implements Provider<Interceptor> {
return 1;
}

if (methodName === MethodType.FINDBYPROFILE) {
return 1;
}

if (methodName === MethodType.GETIMPORTERS) return 2;
return 0;
}
Expand Down

0 comments on commit 2a42f27

Please sign in to comment.