mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 14:44:31 +00:00
Add primary key ref
This commit is contained in:
parent
983a12b874
commit
2f31050a68
@ -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.
|
||||
*
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user