From 84b41f407e2cee242579529f5d51603e44492db5 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 23 Oct 2019 01:20:13 +0200 Subject: [PATCH] Fix multiple query in one graphql request --- .../strapi-plugin-graphql/services/Query.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/strapi-plugin-graphql/services/Query.js b/packages/strapi-plugin-graphql/services/Query.js index 1283c4aa35..80f1101a58 100644 --- a/packages/strapi-plugin-graphql/services/Query.js +++ b/packages/strapi-plugin-graphql/services/Query.js @@ -261,12 +261,22 @@ module.exports = { // cause a lost of the Object prototype. const opts = this.amountLimiting(_options); - ctx.query = { - ...this.convertToParams(_.omit(opts, 'where')), - ...this.convertToQuery(opts.where), - }; + Object.defineProperty(ctx, 'query', { + enumerable: true, + configurable: true, + writable: true, + value: { + ...this.convertToParams(_.omit(opts, 'where')), + ...this.convertToQuery(opts.where), + }, + }); - ctx.params = this.convertToParams(opts); + Object.defineProperty(ctx, 'params', { + enumerable: true, + configurable: true, + writable: true, + value: this.convertToParams(opts), + }); // Execute policies stack. const policy = await compose(policiesFn)(ctx);