Merge branch 'master' into improve-ctm/delete-edit-view

This commit is contained in:
Jim LAURIE 2018-10-09 12:34:37 +02:00 committed by GitHub
commit 5f2582be39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,6 +129,10 @@ module.exports = {
await Promise.all(
<%= globalID %>.associations.map(async association => {
if (!association.via || !data._id) {
return true;
}
const search = _.endsWith(association.nature, 'One') || association.nature === 'oneToMany' ? { [association.via]: data._id } : { [association.via]: { $in: [data._id] } };
const update = _.endsWith(association.nature, 'One') || association.nature === 'oneToMany' ? { [association.via]: null } : { $pull: { [association.via]: data._id } };