7152-devToTest_2414 #2228
|
@ -1,8 +1,8 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('mark', {
|
Self.remoteMethodCtx('setPicked', {
|
||||||
description: 'Insert an itemShelvingSale and Modify a saleTracking record',
|
description: 'Add the sales line of the item and set the tracking.',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
|
@ -46,12 +46,12 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: `/mark`,
|
path: `/setPicked`,
|
||||||
verb: 'POST'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.mark = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => {
|
Self.setPicked = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
|
@ -1,5 +1,5 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
describe('saleTracking mark()', () => {
|
describe('saleTracking setPicked()', () => {
|
||||||
const saleFk = 1;
|
const saleFk = 1;
|
||||||
const originalQuantity = 10;
|
const originalQuantity = 10;
|
||||||
const code = 'PREPARED';
|
const code = 'PREPARED';
|
||||||
|
@ -24,7 +24,7 @@ describe('saleTracking mark()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const code = 'FAKESTATE';
|
const code = 'FAKESTATE';
|
||||||
try {
|
try {
|
||||||
await models.SaleTracking.mark(
|
await models.SaleTracking.setPicked(
|
||||||
ctx,
|
ctx,
|
||||||
saleFk,
|
saleFk,
|
||||||
originalQuantity,
|
originalQuantity,
|
||||||
|
@ -50,7 +50,7 @@ describe('saleTracking mark()', () => {
|
||||||
const tx = await models.SaleTracking.beginTransaction({});
|
const tx = await models.SaleTracking.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
try {
|
try {
|
||||||
await models.SaleTracking.mark(
|
await models.SaleTracking.setPicked(
|
||||||
ctx,
|
ctx,
|
||||||
saleFk,
|
saleFk,
|
||||||
originalQuantity,
|
originalQuantity,
|
||||||
|
@ -63,7 +63,7 @@ describe('saleTracking mark()', () => {
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
await models.SaleTracking.mark(
|
await models.SaleTracking.setPicked(
|
||||||
ctx,
|
ctx,
|
||||||
saleFk,
|
saleFk,
|
||||||
originalQuantity,
|
originalQuantity,
|
||||||
|
@ -89,7 +89,7 @@ describe('saleTracking mark()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
try {
|
try {
|
||||||
const itemShelvingSaleBefore = await models.ItemShelvingSale.find({}, options);
|
const itemShelvingSaleBefore = await models.ItemShelvingSale.find({}, options);
|
||||||
await models.SaleTracking.mark(
|
await models.SaleTracking.setPicked(
|
||||||
ctx,
|
ctx,
|
||||||
saleFk,
|
saleFk,
|
||||||
originalQuantity,
|
originalQuantity,
|
|
@ -4,5 +4,5 @@ module.exports = Self => {
|
||||||
require('../methods/sale-tracking/new')(Self);
|
require('../methods/sale-tracking/new')(Self);
|
||||||
require('../methods/sale-tracking/delete')(Self);
|
require('../methods/sale-tracking/delete')(Self);
|
||||||
require('../methods/sale-tracking/updateTracking')(Self);
|
require('../methods/sale-tracking/updateTracking')(Self);
|
||||||
require('../methods/sale-tracking/mark')(Self);
|
require('../methods/sale-tracking/setPicked')(Self);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue