2

I'm hoping to add a custom query parameter that can be used in a hook to process some results.

I'd like to add $foo=bar to the request. I can whitelist $foo and it appears in the request, but the service is using an ORM so it tries to query the database for $foo=bar.

In a before hook, I can strip $foo from the params.query, but is there somewhere else in the context of the hook that I could stash the value of $foo so that I can act on it in an after hook?

Steven Sokulski
  • 354
  • 1
  • 4
  • 17

1 Answers1

1

I used to delete the params once the functionality is over here we added customer variable $paginate in before find hook.

find: [
      (hook) => {
        if (hook.params.query && hook.params.query.$paginate) {
          hook.params.paginate =
            hook.params.query.$paginate === 'false' ||
            hook.params.query.$paginate === false;
          delete hook.params.query.$paginate;
        }
        return hook;
      }
    ],
Pash
  • 345
  • 4
  • 11