Hello all.. Been searching the interwebs but haven...
# orm-help
k
Hello all.. Been searching the interwebs but haven’t found a good answer. Is there any way to force the client to select certain fields? using the
info
attribute we noticed that if the client leaves out “externalServiceId” we can’t use that attribute in a later stage in the code…
b
From my understanding, you can hard code a selection set, for example:
Copy code
async function login(parent, args, context, info) {
  const user = await context.db.query.user({
    where: { email: args.email }
    }, ` { id password } `
  )
  ...

// here we pass { id password } instead of info
in place of passing in
info
to the resolver . You also haven't mentioned if you want the client to request fields beyond externalServiceId because in that case you can't use the above stated method since it is hard coded, the user's selection set will be ignored. Does that make sense?
f
@kimf Look for
fragmentReplacements
, it can augment the
info
object but I haven’t use it myself. I think there was a post in the forum explaining this.
k
Thanks.. Wen’t with a hard coded selection set of “every available field” for now… and will look into
fragmentReplacements