Skip to content
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

Doubt using graphql type resolvers for more than one query #12

Open
rakshith1994 opened this issue May 19, 2020 · 0 comments
Open

Doubt using graphql type resolvers for more than one query #12

rakshith1994 opened this issue May 19, 2020 · 0 comments

Comments

@rakshith1994
Copy link

Hi scott , my name is rakshith and i had attended your server side graphql in nodejs online course on frontend masters. I had this doubt on resolvers.

There are 2 object types -

User { email , name, post : Post}

Post {body, user: User }

I have 2 mutations - addPost and deletePost

I have written a resolver to addPost , basically it creates a new post in collection. Then i used the type resolver user from post type to fetch user data.

Now in the 2 mutation deletePost . I have written a resolver to delete a post using the id, and i am then trying to use the type resolver from post type that is user to remove the reference of tht post from the user.

The problem here is.. the type resolver user is already fetching me a user data for the earlier addPost mutation. How will i tell it to only run a query that would delete the reference from the user, and not fetch a user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant