【发布时间】:2019-11-13 11:32:57
【问题描述】:
编辑01
我正在运行命令prisma deploy,当命令执行完毕时,所有查询都在文件src/generated/graphql-schema/prisma.graphql 中可见,除了查询listProdutos 没有出现在文件中。
是这样配置的:
解析器/Query.js
function listProdutos (_, args, ctx, info) {
const userId = getUserId(ctx)
return ctx.db.query.produtos({
where: {
OR: [
{
user: {
id: userId
}
}
]
}
}, info)
}
schema.graphql
type Query {
listProdutos: [ Produto! ]!
}
我有以下错误:
{
"data": null,
"errors": [
{
"message": "ctx.db.query.produtos is not a function",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"listProdutos"
]
}
]
}
如果需要,我将项目放入 git:
【问题讨论】: