From dd16633b535b355427601b49b3e8ef4cab707aca Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 19 May 2023 08:34:51 +0200 Subject: [PATCH] try --- .../zone/back/methods/zone/specs/toggleIsIncluded.spec.js | 2 +- modules/zone/back/methods/zone/toggleIsIncluded.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js b/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js index f26eb2eee..b892891b5 100644 --- a/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js +++ b/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js @@ -25,7 +25,7 @@ describe('zone toggleIsIncluded()', () => { try { const options = {transaction: tx}; log('Zone.toggleIsIncluded start'); - let result = models.Zone.toggleIsIncluded(1, 20, true, options); + let result = await models.Zone.toggleIsIncluded(1, 20, true, options); log('Zone.toggleIsIncluded finish'); expect(result.isIncluded).toBeTrue(); diff --git a/modules/zone/back/methods/zone/toggleIsIncluded.js b/modules/zone/back/methods/zone/toggleIsIncluded.js index 50c4ff4ca..f5708d181 100644 --- a/modules/zone/back/methods/zone/toggleIsIncluded.js +++ b/modules/zone/back/methods/zone/toggleIsIncluded.js @@ -35,17 +35,19 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {}; - if (typeof options == 'object') + if (typeof options == 'object') { + log(`Don't use new transacction`); Object.assign(myOptions, options); + } let data; if (isIncluded === undefined) { log('Zone.toggleIsIncluded destroyAll start'); - data = models.ZoneIncluded.destroyAll({zoneFk: id, geoFk: geoId}, myOptions); + data = await models.ZoneIncluded.destroyAll({zoneFk: id, geoFk: geoId}, myOptions); } else { log('Zone.toggleIsIncluded upsert start'); - data = models.ZoneIncluded.upsert({ + data = await models.ZoneIncluded.upsert({ zoneFk: id, geoFk: geoId, isIncluded: isIncluded