Skip to content

Instantly share code, notes, and snippets.

@LawJolla
Last active March 1, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LawJolla/68018c70950c26713b4b704686a34cc7 to your computer and use it in GitHub Desktop.
Save LawJolla/68018c70950c26713b4b704686a34cc7 to your computer and use it in GitHub Desktop.
Wrapped Query
const Query = {
vehicles: async (parent, args, context, info) => {
const vehicles = await context.db.query.vehicles({
where: { dealership: args.id }
})
const user = getUser(context)
return protectFieldsByRole(
[
{ field: `costBasis`, role: `MANAGER` },
{ field: `numberOfOffers`, role: `MANAGER` }
],
vehicles,
user
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment