You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working in a website which presents data coming from an external API. I import the data into custom post types. Now, some custom post types are linked with each other over unique ID's. E.G: Movies and Actors. On Movies, there is a list with actor ID's and vice versa. I would like to query movies and get all the actors having a role in this movie with a nested query.
It seems like this functionality is not part of the plugin, right? Is it possible to get something done like: const BookType = new GraphQLObjectType({ name: 'Book', description: 'This represents a book written by an author', fields: () => ({ id: { type: GraphQLNonNull(GraphQLInt) }, name: { type: GraphQLNonNull(GraphQLString) }, authorId: { type: GraphQLNonNull(GraphQLInt) }, author: { type: AuthorType, resolve: (book) => { return authors.find(author => author.id === book.authorId) } } }) })
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey everybody,
I am currently working in a website which presents data coming from an external API. I import the data into custom post types. Now, some custom post types are linked with each other over unique ID's. E.G: Movies and Actors. On Movies, there is a list with actor ID's and vice versa. I would like to query movies and get all the actors having a role in this movie with a nested query.
It seems like this functionality is not part of the plugin, right? Is it possible to get something done like:
const BookType = new GraphQLObjectType({ name: 'Book', description: 'This represents a book written by an author', fields: () => ({ id: { type: GraphQLNonNull(GraphQLInt) }, name: { type: GraphQLNonNull(GraphQLString) }, authorId: { type: GraphQLNonNull(GraphQLInt) }, author: { type: AuthorType, resolve: (book) => { return authors.find(author => author.id === book.authorId) } } }) })
In WordPress context? With WPGraphQL?
Thanks alot!
Beta Was this translation helpful? Give feedback.
All reactions