mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 23:09:47 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
e9c847adbe
@ -398,25 +398,23 @@ module.exports = {
|
|||||||
queryOpts.skip = convertedParams.start;
|
queryOpts.skip = convertedParams.start;
|
||||||
|
|
||||||
switch (association.nature) {
|
switch (association.nature) {
|
||||||
case 'manyToMany':
|
case 'manyToMany': {
|
||||||
if (association.dominant) {
|
const arrayOfIds = (obj[association.alias] || []).map(
|
||||||
const arrayOfIds = (obj[association.alias] || []).map(
|
related => {
|
||||||
related => {
|
return related[ref.primaryKey] || related;
|
||||||
return related[ref.primaryKey] || related;
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
|
|
||||||
// Where.
|
// Where.
|
||||||
queryOpts.query = strapi.utils.models.convertParams(name, {
|
queryOpts.query = strapi.utils.models.convertParams(name, {
|
||||||
// Construct the "where" query to only retrieve entries which are
|
// Construct the "where" query to only retrieve entries which are
|
||||||
// related to this entry.
|
// related to this entry.
|
||||||
[ref.primaryKey]: arrayOfIds,
|
[ref.primaryKey]: arrayOfIds,
|
||||||
...where.where,
|
...where.where,
|
||||||
}).where;
|
}).where;
|
||||||
break;
|
|
||||||
// falls through
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
// falls through
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Where.
|
// Where.
|
||||||
queryOpts.query = strapi.utils.models.convertParams(name, {
|
queryOpts.query = strapi.utils.models.convertParams(name, {
|
||||||
@ -428,6 +426,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (queryOpts.hasOwnProperty('query') &&
|
||||||
|
queryOpts.query.hasOwnProperty('id') &&
|
||||||
|
queryOpts.query.id.hasOwnProperty('value') &&
|
||||||
|
Array.isArray(queryOpts.query.id.value)
|
||||||
|
){
|
||||||
|
queryOpts.query.id.symbol = 'IN';
|
||||||
|
}
|
||||||
|
|
||||||
const value = await (association.model
|
const value = await (association.model
|
||||||
? resolvers.fetch(params, association.plugin, [])
|
? resolvers.fetch(params, association.plugin, [])
|
||||||
: resolvers.fetchAll(params, { ...queryOpts, populate: [] }));
|
: resolvers.fetchAll(params, { ...queryOpts, populate: [] }));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user