2023-09-27 12:01:17 +00:00
|
|
|
module.exports = Self => {
|
2023-09-28 11:26:05 +00:00
|
|
|
Self.remoteMethodCtx('itemShelvingSaleSetQuantity', {
|
2023-09-27 12:01:17 +00:00
|
|
|
description: 'Set quanitity of a sale in itemShelvingSale',
|
|
|
|
accessType: 'WRITE',
|
|
|
|
accepts: [
|
|
|
|
{
|
|
|
|
arg: 'id',
|
2023-09-28 06:08:40 +00:00
|
|
|
type: 'number',
|
|
|
|
required: true,
|
2023-09-27 12:01:17 +00:00
|
|
|
description: 'The sale id',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'quantity',
|
2023-09-28 06:08:40 +00:00
|
|
|
type: 'number',
|
|
|
|
required: true,
|
2023-09-27 12:01:17 +00:00
|
|
|
description: 'The quantity to set',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'isItemShelvingSaleEmpty',
|
2023-09-28 06:08:40 +00:00
|
|
|
type: 'boolean',
|
|
|
|
required: true,
|
2023-09-27 12:01:17 +00:00
|
|
|
description: 'True if the shelvingFk is empty ',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
http: {
|
|
|
|
path: `/itemShelvingSaleSetQuantity`,
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-09-28 11:26:05 +00:00
|
|
|
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);
|
2023-09-27 12:01:17 +00:00
|
|
|
};
|
|
|
|
};
|