diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/addListByItem.js similarity index 90% rename from modules/item/back/methods/item-shelving/makeMulti.js rename to modules/item/back/methods/item-shelving/addListByItem.js index 9992eaf57..da8ed0e1b 100644 --- a/modules/item/back/methods/item-shelving/makeMulti.js +++ b/modules/item/back/methods/item-shelving/addListByItem.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('makeMulti', { + Self.remoteMethodCtx('addListByItem', { description: 'Add a record or update it if it already exists.', accessType: 'WRITE', accepts: [{ @@ -20,12 +20,12 @@ module.exports = Self => { }], http: { - path: `/makeMulti`, + path: `/addListByItem`, verb: 'POST' } }); - Self.makeMulti = async(ctx, shelvingFk, items, warehouseFk, options) => { + Self.addListByItem = async(ctx, shelvingFk, items, warehouseFk, options) => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; diff --git a/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js b/modules/item/back/methods/item-shelving/specs/addListByItem.spec.js similarity index 85% rename from modules/item/back/methods/item-shelving/specs/makeMulti.spec.js rename to modules/item/back/methods/item-shelving/specs/addListByItem.spec.js index d5df0493c..2d9dd600a 100644 --- a/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js +++ b/modules/item/back/methods/item-shelving/specs/addListByItem.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); -describe('ItemShelving makeMulti()', () => { +describe('ItemShelving addListByItem()', () => { const warehouseFk = 1; let ctx; let options; @@ -33,7 +33,7 @@ describe('ItemShelving makeMulti()', () => { const shelvingFk = 'ZPP'; const items = [1, 1, 1, 2]; - await models.ItemShelving.makeMulti(ctx, shelvingFk, items, warehouseFk, options); + await models.ItemShelving.addListByItem(ctx, shelvingFk, items, warehouseFk, options); const itemShelvings = await models.ItemShelving.find({where: {shelvingFk}}, options); expect(itemShelvings.length).toEqual(2); @@ -45,7 +45,7 @@ describe('ItemShelving makeMulti()', () => { const {visible: itemsBefore} = await models.ItemShelving.findOne({ where: {shelvingFk, itemFk: items[0]} }, options); - await models.ItemShelving.makeMulti(ctx, shelvingFk, items, warehouseFk, options); + await models.ItemShelving.addListByItem(ctx, shelvingFk, items, warehouseFk, options); const {visible: itemsAfter} = await models.ItemShelving.findOne({ where: {shelvingFk, itemFk: items[0]} }, options); diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 9bc94fa1e..a3c596f94 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,5 +1,5 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); - require('../methods/item-shelving/makeMulti')(Self); + require('../methods/item-shelving/addListByItem')(Self); require('../methods/item-shelving/getInventory')(Self); };