I have this graphql query, its looking for all services associated with a project( given its id ) and for each services, it returns the list of users who have access to.
query Project ($id: ID!) {
services {
mailService {
users
}
}
}
I want to know what's the best solution to pass the id
parameter and use it inside the users
resolver function.
I am thinking about these solutions :
- Add $id parameter for both mailService and users nodes in query.
- In the graphql middleware in server, add parameters object to the context field ( from the request.body)
- Add a field in context object in Project resolver : context.projectId = $id and use it in sub fields resolvers.
Thanks for help