-
Notifications
You must be signed in to change notification settings - Fork 121
feat: support custom resolvers #674
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
Merged
Weakky
merged 6 commits into
graphql-nexus:master
from
craigspaeth:cs/support-crud-middleware
Jun 5, 2020
Merged
feat: support custom resolvers #674
Weakky
merged 6 commits into
graphql-nexus:master
from
craigspaeth:cs/support-crud-middleware
Jun 5, 2020
Conversation
This file contains hidden or 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
4b64359 to
ef44718
Compare
|
Hey @craigspaeth, We've taken the liberty to update your PR and get it into a mergeable state. We've also made some modification to your original proposal:
UsagequeryType({
definition(t) {
t.crud.users({
async resolve(root, args, ctx, info, originalResolve) {
console.log('before')
const res = await originalResolve(root, args, ctx, info)
console.log('after')
return res
}
})
}
}) |
jasonkuhrt
approved these changes
Jun 5, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
@craigspaeth Thanks a lot for leading that effort, merging now 🚀 |
This was referenced Jun 5, 2020
|
Wow—amazing, thank you so much @Weakky and team! ❤️ 🚀 |
This was referenced Jun 8, 2020
Closed
15 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt at addressing some issues people are raising for the desire to hook into the CRUD operations. It solves this with middleware that can be used like so...
I'm very open to an alternative implementation like
beforeandafteror whatever you all recommend. Whatever shape it takes hooking into the CRUD lifecycle is a feature I'd love to see in this plugin.This code works for me but two weird things happened when I tried to write a test and clean this up...
Let me know what I can do to work past this and get this into a mergeable state.
Update:
Closes #684, #541, #550