salix/modules/item/back/methods/item-shelving-sale/itemShelvingSaleSetQuantity.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

module.exports = Self => {
2023-09-28 11:26:05 +00:00
Self.remoteMethodCtx('itemShelvingSaleSetQuantity', {
2024-07-17 14:09:09 +00:00
description: 'Set quantity of a sale in itemShelvingSale',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
2023-09-28 06:08:40 +00:00
type: 'number',
required: true,
description: 'The sale id',
},
{
arg: 'quantity',
2023-09-28 06:08:40 +00:00
type: 'number',
required: true,
description: 'The quantity to set',
},
{
arg: 'isItemShelvingSaleEmpty',
2023-09-28 06:08:40 +00:00
type: 'boolean',
required: true,
description: 'True if the shelvingFk is empty ',
2024-07-17 14:09:09 +00:00
},
{
arg: 'sectorFk',
type: 'number',
required: true,
description: 'Sector Id',
}
],
http: {
path: `/itemShelvingSaleSetQuantity`,
verb: 'POST'
}
});
2024-07-17 14:09:09 +00:00
Self.itemShelvingSaleSetQuantity = async(ctx, id, quantity, isItemShelvingSaleEmpty, sectorFk, options) => {
2023-09-28 11:26:05 +00:00
const myOptions = {userId: ctx.req.accessToken.userId};
if (typeof options == 'object')
Object.assign(myOptions, options);
2024-07-17 14:09:09 +00:00
await Self.rawSql(`CALL vn.itemShelvingSale_setQuantity(?, ?, ?, ?)`,
[id, quantity, isItemShelvingSaleEmpty, sectorFk],
2023-09-28 11:26:05 +00:00
myOptions);
};
};