Merge branch 'master' into bug/4104-update-url-of-settings-button-for-content-manager-plugincard

This commit is contained in:
Jim LAURIE 2019-09-26 19:47:55 +02:00 committed by GitHub
commit 2c5ee6d41a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -159,7 +159,7 @@ module.exports = {
return _.set(
acc,
current,
property.map(val => val[assocModel.primaryKey] || val)
property ? property.map(val => val[assocModel.primaryKey] || val) : property
);
}
@ -187,12 +187,12 @@ module.exports = {
return assocModel.updateMany(
{
[assocModel.primaryKey]: {
$in: property.map(
$in: property ? property.map(
val =>
new mongoose.Types.ObjectId(
val[assocModel.primaryKey] || val
)
),
) : property,
},
},
{

View File

@ -172,9 +172,7 @@ const buildAssocResolvers = (model, name, { plugin }) => {
_.set(
queryOpts,
['query', ref.primaryKey],
obj[association.alias].map(val => val[ref.primaryKey] || val) ||
[]
);
(obj[association.alias] ? obj[association.alias].map(val => val[ref.primaryKey] || val) : []));
} else {
_.set(queryOpts, ['query', association.via], obj[ref.primaryKey]);
}