Regarding to this post: https://stackoverflow.com/a/69903276/1547821 it shows an approach with less boilerplate, to prevent a users query output (GET) to only the user who is logged in.
But how to do this, to get i.e. all members of the related group which the logged-in user participates?
This example below is my hook, but i want to have it in before->find hook as a query injection or addition.
module.exports = (options = {}) => {
return async context => {
const groupMembers = await context.app.service('groups').options.model.relatedQuery('users').for(context.params.user.id)
console.log(groupMembers)
return context
}
}
It doesn't help me as after->find hook, because total
and etc. doesn't match then. Aswell my keeps
doesn't work.
Appreciating any hints.