From 8a5da43503f774c26b26817e45388679cec38dd7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 16:00:25 +0100 Subject: [PATCH] refactor: sectorCollection_getSale refs #6276 --- db/changes/235001/00-newWareHouse.sql | 3 ++- modules/item/back/models/item-shelving.js | 1 - .../back/methods/sale/getFromSectorCollection.js} | 10 +++++----- modules/ticket/back/models/sale.js | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) rename modules/{item/back/methods/item-shelving/getSale.js => ticket/back/methods/sale/getFromSectorCollection.js} (84%) diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index c088a8730..60d2658b0 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -14,5 +14,6 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('MachineWorker', 'updateInTime', 'WRITE', 'ALLOW', 'ROLE', 'production');; + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index e349b9c34..4eb5374e8 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -4,5 +4,4 @@ module.exports = Self => { require('../methods/item-shelving/makeMulti')(Self); require('../methods/item-shelving/return')(Self); require('../methods/item-shelving/updateFromSale')(Self); - require('../methods/item-shelving/getSale')(Self); }; diff --git a/modules/item/back/methods/item-shelving/getSale.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js similarity index 84% rename from modules/item/back/methods/item-shelving/getSale.js rename to modules/ticket/back/methods/sale/getFromSectorCollection.js index 826ac03e1..9e4f24fbb 100644 --- a/modules/item/back/methods/item-shelving/getSale.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -1,7 +1,7 @@ module.exports = Self => { - Self.remoteMethod('getSale', { - description: 'Update the visible items', - accessType: 'WRITE', + Self.remoteMethod('getFromSectorCollection', { + description: 'Get sales from sector collection', + accessType: 'READ', accepts: [ { arg: 'sectorCollectionFk', @@ -19,12 +19,12 @@ module.exports = Self => { root: true }, http: { - path: `/getSale`, + path: `/getFromSectorCollection`, verb: 'GET' }, }); - Self.getSale = async(sectorCollectionFk, sectorFk, options) => { + Self.getFromSectorCollection = async(sectorCollectionFk, sectorFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index d6f06d744..7cac50a13 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -13,6 +13,7 @@ module.exports = Self => { require('../methods/sale/canEdit')(Self); require('../methods/sale/usesMana')(Self); require('../methods/sale/clone')(Self); + require('../methods/sale/getFromSectorCollection')(Self); Self.validatesPresenceOf('concept', { message: `Concept cannot be blank`