From 5111efa2b97a7110fbb7bdfe06626ce9e369e9af Mon Sep 17 00:00:00 2001 From: gerard Date: Tue, 8 May 2018 09:57:11 +0200 Subject: [PATCH] refactorizacion InstallCrudModel CR: JUAN --- services/loopback/common/methods/vnModel/installCrudModel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/loopback/common/methods/vnModel/installCrudModel.js b/services/loopback/common/methods/vnModel/installCrudModel.js index 5ec2ab997..4ab6f6d1d 100644 --- a/services/loopback/common/methods/vnModel/installCrudModel.js +++ b/services/loopback/common/methods/vnModel/installCrudModel.js @@ -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)); });