We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if
Hello, For example I have an upsertTodo mutation
upsertTodo
By judging whether there is an id parameter in the input
If it's a create, all users can, if it's an update, it must be the owner of the object
Thanks
The text was updated successfully, but these errors were encountered:
Hi @kxbin ! Sorry for the late response.
you can use regular if condition inside any shield rule, just like this:
rule()(async (parent, args, ctx) => { if (!args.id) { return true; } const existingTodo = await db.getTodoById(args.id); if (existingTodo.ownerId === ctx.userId) { return true; } return false; })
Please feel free to reopen the issue if there are still some questions!
Sorry, something went wrong.
Thanks so much
No branches or pull requests
Question about GraphQL Shield
Hello, For example I have an
upsertTodo
mutationBy judging whether there is an id parameter in the input
If it's a create, all users can, if it's an update, it must be the owner of the object
Thanks
The text was updated successfully, but these errors were encountered: