So i'm kinda new to graphql and i'm facing a problem which i don't know how to resolve. I'm using nodeJs and apollo.
I have a profile micro-service who has an User type:
type User @key(fields: "_id") {
${userFields}
}
And i also have a progression micro-service where i extend the User type:
extend type User @key(fields: "_id") {
_id: ID! @external,
progression: Progression
}
type Progression {
currentGOTW: Int,
totalGOTW: Int,
video(playlistId: String!, itemIndex: Int!): [Int]
}
As you can see i extended the User type to add a Progression field, and the problem comes from the video field which needs two arguments.
The progression resolver looks like this:
User: {
async progression (user, data) {
console.log(data)
const videoProgression = await UserWatched.get({ playlist_id: data.playlistId, item_index: data.itemIndex, userRef: user._id })
return videoProgression
}
}
In this resolver i'm expecting to get playlistId and itemIndex in data but when i console.log it, data is empty. I don't have any errors and i tried displaying args that are after data in the resolver function but they didn't contain what i want either.
This is my query:
const query = gql`
{
User {
progression {
video(playlistId: "playlist", itemIndex: 3)
}
}
}`
And i need to get the "playlist" and the 3 in my resolver.
I didn't find any answers for that and i'm starting to think that maybe it's impossible for now...