-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
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
Prisma2 CRUD: "before" and "after" hooks #541
Comments
Yes please! |
It would be great if they would also support some authorization hook. |
I could also really use this to log the actions being taken. + 1 |
+1 |
This feature was implemented in #674. It's slightly different than this proposal, check out the PR to see the final implementation. We've just released [email protected]. |
When using the
crud
functionality of nexus-prisma I would like to do something before or after the mutation is executed.Maybe this can also be used to manipulate the result, which is returned to the client.
For Example:
I am using the
t.crud.createOneTicket();
functionality to give the client the ability to create a new ticket.After the ticket is created I have to create one or multiple stages, the ticket has to go through based on some calculations.
Right now the client would have to do the calculations and send multiple mutations to be able to do this. Which could lead to a corrupted application state on a flaky network.
It would be great, if the
crud
methods would provide some kind of hooks before and after they are executed. Kind of like how https://github.com/mickhansen/graphql-sequelize#options is doing it:This way the crud operations would become much more flexible and operations which are dependent on each other could be executed with just one network request.
The text was updated successfully, but these errors were encountered: