42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
module.exports = Self => {
|
|
Self.remoteMethodCtx('itemShelvingSaleSetQuantity', {
|
|
description: 'Set quanitity of a sale in itemShelvingSale',
|
|
accessType: 'WRITE',
|
|
accepts: [
|
|
{
|
|
arg: 'id',
|
|
type: 'number',
|
|
required: true,
|
|
description: 'The sale id',
|
|
},
|
|
{
|
|
arg: 'quantity',
|
|
type: 'number',
|
|
required: true,
|
|
description: 'The quantity to set',
|
|
},
|
|
{
|
|
arg: 'isItemShelvingSaleEmpty',
|
|
type: 'boolean',
|
|
required: true,
|
|
description: 'True if the shelvingFk is empty ',
|
|
}
|
|
],
|
|
http: {
|
|
path: `/itemShelvingSaleSetQuantity`,
|
|
verb: 'POST'
|
|
}
|
|
});
|
|
|
|
Self.itemShelvingSaleSetQuantity = async(ctx, id, quantity, isItemShelvingSaleEmpty, options) => {
|
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
|
|
|
if (typeof options == 'object')
|
|
Object.assign(myOptions, options);
|
|
|
|
await Self.rawSql(`CALL vn.itemShelvingSale_setQuantity(?, ?, ? )`,
|
|
[id, quantity, isItemShelvingSaleEmpty],
|
|
myOptions);
|
|
};
|
|
};
|