refactorizacion InstallCrudModel CR: JUAN
This commit is contained in:
parent
ba5a135434
commit
5111efa2b9
|
@ -27,10 +27,10 @@ module.exports = function(Self) {
|
||||||
if (crudObject.delete && crudObject.delete.length) {
|
if (crudObject.delete && crudObject.delete.length) {
|
||||||
promises.push(Model.destroyAll({id: {inq: crudObject.delete}}, options));
|
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));
|
promises.push(Model.create(crudObject.create, options));
|
||||||
}
|
}
|
||||||
if (crudObject.update.length) {
|
if (crudObject.update) {
|
||||||
crudObject.update.forEach(toUpdate => {
|
crudObject.update.forEach(toUpdate => {
|
||||||
promises.push(Model.upsert(toUpdate, options));
|
promises.push(Model.upsert(toUpdate, options));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue