Merge pull request #3416 from strapi/fix/custom-graphql-query

Fix primaryKey not found for custom resolvers
This commit is contained in:
Alexandre BODIN 2019-06-11 18:16:14 +02:00 committed by GitHub
commit e79e110add
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,14 +286,17 @@ module.exports = {
Object.defineProperties(ctx, {
query: {
value: {
...this.convertToParams(_.omit(opts, 'where'), model.primaryKey),
...this.convertToParams(
_.omit(opts, 'where'),
model ? model.primaryKey : 'id'
),
...this.convertToQuery(opts.where),
},
writable: true,
configurable: true,
},
params: {
value: this.convertToParams(opts, model.primaryKey),
value: this.convertToParams(opts, model ? model.primaryKey : 'id'),
writable: true,
configurable: true,
},