From e8d7ce7cc744dcfcf0148b6585feb1f3dfc7c3eb Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Mar 2022 14:50:51 +0100 Subject: [PATCH 1/3] refactor(ticket): change role productionBoss to deliveryBoss --- modules/ticket/back/methods/ticket/componentUpdate.js | 4 ++-- modules/ticket/back/methods/ticket/isEditable.js | 4 ++-- modules/ticket/back/methods/ticket/priceDifference.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 2294e6d25..d9fe259ea 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -116,8 +116,8 @@ module.exports = Self => { if (!isEditable) throw new UserError(`The sales of this ticket can't be modified`); - const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions); - if (!isProductionBoss) { + const isDeliveryBoss = await models.Account.hasRole(userId, 'deliveryBoss', myOptions); + if (!isDeliveryBoss) { const zoneShipped = await models.Agency.getShipped( args.landed, args.addressFk, diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index a444691ac..5b9a397a1 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -31,10 +31,10 @@ module.exports = Self => { }, myOptions); const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant', myOptions); - const isProductionBoss = await Self.app.models.Account.hasRole(userId, 'productionBoss', myOptions); + const isDeliveryBoss = await Self.app.models.Account.hasRole(userId, 'deliveryBoss', myOptions); const isBuyer = await Self.app.models.Account.hasRole(userId, 'buyer', myOptions); - const isValidRole = isSalesAssistant || isProductionBoss || isBuyer; + const isValidRole = isSalesAssistant || isDeliveryBoss || isBuyer; let alertLevel = state ? state.alertLevel : null; let ticket = await Self.app.models.Ticket.findById(id, { diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index e0ffac55a..0e8cc2e06 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -78,8 +78,8 @@ module.exports = Self => { if (!isEditable) throw new UserError(`The sales of this ticket can't be modified`); - const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions); - if (!isProductionBoss) { + const isDeliveryBoss = await models.Account.hasRole(userId, 'deliveryBoss', myOptions); + if (!isDeliveryBoss) { const zoneShipped = await models.Agency.getShipped( args.landed, args.addressId, From 31eb22c1b41519b597f05fa535ab48b9c84b53d6 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 14 Mar 2022 11:34:09 +0100 Subject: [PATCH 2/3] feat(db): update users to role deliveryBoss --- db/changes/10430-ash/00-deliveryBoss.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/changes/10430-ash/00-deliveryBoss.sql diff --git a/db/changes/10430-ash/00-deliveryBoss.sql b/db/changes/10430-ash/00-deliveryBoss.sql new file mode 100644 index 000000000..a4bcdcd0c --- /dev/null +++ b/db/changes/10430-ash/00-deliveryBoss.sql @@ -0,0 +1,3 @@ +UPDATE `account`.`user` +SET `role` = 57 +WHERE id IN (2294, 4365, 7294); \ No newline at end of file From f774b1f7846876678e8516e8dce51e3b3db3f0a1 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 15 Mar 2022 09:13:35 +0100 Subject: [PATCH 3/3] typo --- modules/zone/front/delivery-days/index.js | 6 +++--- modules/zone/front/delivery-days/index.spec.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js index 21c65678f..e4d5e72e9 100644 --- a/modules/zone/front/delivery-days/index.js +++ b/modules/zone/front/delivery-days/index.js @@ -69,14 +69,14 @@ class Controller extends Section { if (!$events.length) return; const day = $days[0]; - const zonesIds = []; + const zoneIds = []; for (let event of $events) - zonesIds.push(event.zoneFk); + zoneIds.push(event.zoneFk); this.$.zoneEvents.show($event.target); const params = { - zonesId: zonesIds, + zoneIds: zoneIds, date: day }; diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js index 3d71bc93f..63c87fbea 100644 --- a/modules/zone/front/delivery-days/index.spec.js +++ b/modules/zone/front/delivery-days/index.spec.js @@ -110,7 +110,7 @@ describe('Zone Component vnZoneDeliveryDays', () => { {zoneFk: 8} ]; const params = { - zonesId: [1, 2, 8], + zoneIds: [1, 2, 8], date: [day][0] }; const response = [{id: 1, hour: ''}];