From d6349f113cfb4979d3e3064d12d600a92bffb462 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 11 Nov 2024 08:06:22 +0100 Subject: [PATCH 1/4] feat: refs #7743 add simple spec for sendMail --- .../specs/sendMail.spec.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js new file mode 100644 index 000000000..133d7271c --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -0,0 +1,20 @@ +const models = require('vn-loopback/server/server').models; + +describe('sendMail', () => { + it('should insert in mail', async() => { + const ctx = { + req: {accessToken: {userId: 50}}, + args: {workerFk: 1106, year: 2001, week: 1} + }; + const tx = await models.Sale.beginTransaction({}); + const options = {transaction: tx}; + options.transaction = tx; + + const mailCountBefore = await models.Mail.count(options); + await models.WorkerTimeControl.sendMail(ctx, options); + const mailCountAfter = await models.Mail.count(options); + + expect(mailCountAfter).toBeGreaterThan(mailCountBefore); + await tx.rollback(); + }); +}); From 50a73c98a2b3a2e3a39f4cc2b497bc507799f171 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 11 Nov 2024 08:12:07 +0100 Subject: [PATCH 2/4] feat: refs #7743 add try catch stmt to the test --- .../worker-time-control/specs/login.spec.js | 1 - .../specs/sendMail.spec.js | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/specs/login.spec.js b/modules/worker/back/methods/worker-time-control/specs/login.spec.js index e125a876d..eff0edaa7 100644 --- a/modules/worker/back/methods/worker-time-control/specs/login.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/login.spec.js @@ -1,5 +1,4 @@ const models = require('vn-loopback/server/server').models; -const LoopBackContext = require('loopback-context'); const UserError = require('vn-loopback/util/user-error'); describe('workerTimeControl login()', () => { diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js index 133d7271c..1395c7a46 100644 --- a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -2,17 +2,24 @@ const models = require('vn-loopback/server/server').models; describe('sendMail', () => { it('should insert in mail', async() => { + const tx = await models.Sale.beginTransaction({}); + const options = {transaction: tx}; + options.transaction = tx; + let mailCountBefore; + let mailCountAfter; const ctx = { req: {accessToken: {userId: 50}}, args: {workerFk: 1106, year: 2001, week: 1} }; - const tx = await models.Sale.beginTransaction({}); - const options = {transaction: tx}; - options.transaction = tx; - const mailCountBefore = await models.Mail.count(options); - await models.WorkerTimeControl.sendMail(ctx, options); - const mailCountAfter = await models.Mail.count(options); + try { + mailCountBefore = await models.Mail.count(options); + await models.WorkerTimeControl.sendMail(ctx, options); + mailCountAfter = await models.Mail.count(options); + } catch (e) { + await tx.rollback(); + throw e; + } expect(mailCountAfter).toBeGreaterThan(mailCountBefore); await tx.rollback(); From 07318656b78ebde742ad48a9b36bff327a7755d8 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 15 Nov 2024 08:47:30 +0100 Subject: [PATCH 3/4] feat: refs #8135 refs#8135 updateTicketACL --- db/versions/11349-azureBamboo/00-firstScript.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 db/versions/11349-azureBamboo/00-firstScript.sql diff --git a/db/versions/11349-azureBamboo/00-firstScript.sql b/db/versions/11349-azureBamboo/00-firstScript.sql new file mode 100644 index 000000000..09c919b79 --- /dev/null +++ b/db/versions/11349-azureBamboo/00-firstScript.sql @@ -0,0 +1,7 @@ + + +UPDATE salix.ACL + SET principalId = 'deliveryAssistant' +WHERE model = 'Ticket' + AND property = 'updateAttributes' + AND principalId = "delivery"; From b529ccfe2919102c548e3401ee45f94073164600 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 15 Nov 2024 12:43:15 +0100 Subject: [PATCH 4/4] feat: refs #7920 Added ItemShelving in shelvingLog --- db/versions/11350-silverArborvitae/00-firstScript.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/versions/11350-silverArborvitae/00-firstScript.sql diff --git a/db/versions/11350-silverArborvitae/00-firstScript.sql b/db/versions/11350-silverArborvitae/00-firstScript.sql new file mode 100644 index 000000000..b5e87133e --- /dev/null +++ b/db/versions/11350-silverArborvitae/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.shelvingLog + MODIFY COLUMN changedModel enum('Shelving', 'ItemShelving') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Shelving' NOT NULL;