Last active
March 1, 2018 15:39
-
-
Save LawJolla/68018c70950c26713b4b704686a34cc7 to your computer and use it in GitHub Desktop.
Wrapped Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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