问题描述
type ProcessoLivroRegistos{
id: ID!
imovel: Imovel
valor_imovel: String
comissao: String
data_inicio: String
data_fim: String
}
“imovel”字段也需要解析。因此,我添加了一个简单的解析器:
Query: {
livro_registos: authenticated(authorized(['COORDENACAO','ADMIN'],async(_,{input},{db}) => {
const livro_registos = db.collection('livro_registos');
let processos = await livro_registos.find({}).toArray();
return processos;
})),},ProcessoLivroRegistos: {
async imovel(route,_,{db}){
const collection = db.collection('imoveis');
let imovel = await collection.findOne({_id: ObjectId(route["imovel_id"])});
return imovel;
}
},
当我查询时它工作正常,但问题是当我有一个返回类型“ProcessoLivroRegistos”的突变时,因为它没有解析“imovel”字段。
普通解析器是否可以处理突变?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)