Add primary key ref

This commit is contained in:
Jim LAURIE 2019-03-15 17:49:46 +01:00
parent 983a12b874
commit 2f31050a68
2 changed files with 2 additions and 16 deletions

View File

@ -13,20 +13,6 @@ const Query = require('./Query.js');
/* eslint-disable no-unused-vars */
module.exports = {
/**
* Convert parameters to valid filters parameters.
*
* @return Object
*/
convertToParams: params => {
return Object.keys(params).reduce((acc, current) => {
return Object.assign(acc, {
[`_${current}`]: params[current],
});
}, {});
},
/**
* Execute policies before the specified resolver.
*

View File

@ -374,7 +374,7 @@ module.exports = {
// Apply optional arguments to make more precise nested request.
const convertedParams = strapi.utils.models.convertParams(
name,
Query.convertToParams(Query.amountLimiting(options)),
Query.convertToParams(Query.amountLimiting(options), ref.primaryKey),
);
const where = strapi.utils.models.convertParams(
@ -395,7 +395,7 @@ module.exports = {
return related[ref.primaryKey] || related;
}
);
Object.assign(queryOpts, {
...queryOpts,
query: {