mark
01/24/2019, 10:37 PMreturn prisma.mutation.createPost(
{
data: {
...args.data,
author: {
connect: {
id: args.data.author,
},
},
},
},
info,
)Noah
01/24/2019, 10:48 PMdata key for updates, not for inserts.
{
"data": null,
"errors": [
{
"message": "Variable '$data' expected value of type 'GameCreateInput!' but got: {\"data\":{\"playerOne\":{\"connect\":{\"id\":\"cjrb7hmij003s0894h2t8l326\"}},\"board\":\"[[]]\"}}. Reason: 'data' Field 'data' is not defined in the input type 'GameCreateInput'. (line 1, column 11):\nmutation ($data: GameCreateInput!) {\n ^",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createGame"
]
}
]
}
Resolver:
async function createGame(parent, args, context, info) {
const game = await context.prisma.createGame({
data: {
playerOne: { connect: { id: args.userId } },
board: "[[]]"
}
})
return game
}
My original mutation was creating a Game object, but there were no connections to that object, which is where I'm confused.Noah
01/24/2019, 11:31 PMmark
01/24/2019, 11:41 PMNoah
01/26/2019, 1:41 AM