From fa9dfdf411ef9028f04853567a07abefe790635e Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Jul 2023 16:32:38 +0200 Subject: [PATCH] refs #5216 try ACL updateExpeditionState --- db/changes/233201/00-addExpeditionState.sql | 2 ++ .../{updateExpeditionState.js => addExpeditionState.js} | 5 +++-- modules/ticket/back/models/expedition-state.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 db/changes/233201/00-addExpeditionState.sql rename modules/ticket/back/methods/expedition-state/{updateExpeditionState.js => addExpeditionState.js} (92%) diff --git a/db/changes/233201/00-addExpeditionState.sql b/db/changes/233201/00-addExpeditionState.sql new file mode 100644 index 000000000..fb236b0c3 --- /dev/null +++ b/db/changes/233201/00-addExpeditionState.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','delivery'); \ No newline at end of file diff --git a/modules/ticket/back/methods/expedition-state/updateExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js similarity index 92% rename from modules/ticket/back/methods/expedition-state/updateExpeditionState.js rename to modules/ticket/back/methods/expedition-state/addExpeditionState.js index ce5144d30..d22d7c676 100644 --- a/modules/ticket/back/methods/expedition-state/updateExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -17,7 +17,7 @@ module.exports = Self => { } ], http: { - path: `/updateExpeditionState`, + path: `/addExpeditionState`, verb: 'post' } }); @@ -52,10 +52,11 @@ module.exports = Self => { const typeFk = result[0].id; - const newExpeditionState = await models.Self.create({ + const newExpeditionState = models.Self.create({ expeditionFk: expedition.expeditionFk, typeFk, }); + promises.push(newExpeditionState); } await Promise.all(promises); diff --git a/modules/ticket/back/models/expedition-state.js b/modules/ticket/back/models/expedition-state.js index 041c57be6..496dd88d3 100644 --- a/modules/ticket/back/models/expedition-state.js +++ b/modules/ticket/back/models/expedition-state.js @@ -1,4 +1,4 @@ module.exports = function(Self) { require('../methods/expedition-state/filter')(Self); - require('../methods/expedition-state/updateExpeditionState')(Self); + require('../methods/expedition-state/addExpeditionState')(Self); };