When the client make request to one service and inside the hook of the service you want to fetch data from another service you can persist user and provider to keep the user abilities
const {callingParamsPersistUser} = require('feathers-mongoose-casl') // Inside some hook hooks({ before: { get: [ async function(hook){ const productService = hook.app.service('products'); const product = await productService.find(callingParamsPersistUser(hook.params,{query: {'color': 'red'}})) }; })
async find (params) { const productService = hook.app.service('products'); const product = await productService.find(callingParamsPersistUser(params,{query: {'color': 'red'}})) }
Last updated 5 years ago