refs #6915 test_master24_8 #2067
|
@ -1,7 +1,7 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('ItemShelving addListByItem()', () => {
|
||||
describe('ItemShelving upsertItem()', () => {
|
||||
const warehouseFk = 1;
|
||||
let ctx;
|
||||
let options;
|
||||
|
@ -33,7 +33,7 @@ describe('ItemShelving addListByItem()', () => {
|
|||
const shelvingFk = 'ZPP';
|
||||
const items = [1, 1, 1, 2];
|
||||
|
||||
await models.ItemShelving.addListByItem(ctx, shelvingFk, items, warehouseFk, options);
|
||||
await models.ItemShelving.upsertItem(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 addListByItem()', () => {
|
|||
const {visible: itemsBefore} = await models.ItemShelving.findOne({
|
||||
where: {shelvingFk, itemFk: items[0]}
|
||||
}, options);
|
||||
await models.ItemShelving.addListByItem(ctx, shelvingFk, items, warehouseFk, options);
|
||||
await models.ItemShelving.upsertItem(ctx, shelvingFk, items, warehouseFk, options);
|
||||
const {visible: itemsAfter} = await models.ItemShelving.findOne({
|
||||
where: {shelvingFk, itemFk: items[0]}
|
||||
}, options);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('addListByItem', {
|
||||
Self.remoteMethodCtx('upsertItem', {
|
||||
description: 'Add a record or update it if it already exists.',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -20,12 +20,12 @@ module.exports = Self => {
|
|||
}],
|
||||
|
||||
http: {
|
||||
path: `/addListByItem`,
|
||||
path: `/upsertItem`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.addListByItem = async(ctx, shelvingFk, items, warehouseFk, options) => {
|
||||
Self.upsertItem = async(ctx, shelvingFk, items, warehouseFk, options) => {
|
||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||
let tx;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/item-shelving/deleteItemShelvings')(Self);
|
||||
require('../methods/item-shelving/addListByItem')(Self);
|
||||
require('../methods/item-shelving/upsertItem')(Self);
|
||||
require('../methods/item-shelving/getInventory')(Self);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue