refactorizacion InstallCrudModel CR: JUAN

This commit is contained in:
gerard 2018-05-08 09:57:11 +02:00
parent ba5a135434
commit 5111efa2b9
1 changed files with 2 additions and 2 deletions

View File

@ -27,10 +27,10 @@ module.exports = function(Self) {
if (crudObject.delete && crudObject.delete.length) {
promises.push(Model.destroyAll({id: {inq: crudObject.delete}}, options));
}
if (crudObject.create.length) {
if (crudObject.create && crudObject.create.length) {
promises.push(Model.create(crudObject.create, options));
}
if (crudObject.update.length) {
if (crudObject.update) {
crudObject.update.forEach(toUpdate => {
promises.push(Model.upsert(toUpdate, options));
});