【发布时间】:2017-04-26 21:10:49
【问题描述】:
GraphQL 使用 Sequelize 更新返回 null。
updatePerson: {
type: Person,
args: {
value: {
type: UpdatePersonInputType
},
where: {
type: WhereUpdatePersonInputType
}
},
resolve(_, args) {
return Db.models.persons.update( args.value, {
where: args.where
});
}
},
这是我使用 GraphiQL 的请求
mutation {
updatePerson(value: {firstName: "John", lastName: "Doe", email: "johndoe@example.com"}, where: {id: 1}){
id
firstName
lastName
email
}
}
这就是结果
{
"data": {
"updatePerson": {
"id": null,
"firstName": null,
"lastName": null,
"email": null
}
}
}
也许我在使用 Sequelize 更新时会出错。谁能解释发生了什么?
【问题讨论】:
-
这方面有什么更新吗?
标签: javascript sequelize.js graphql graphql-js