Añadido collectionMissingTrash y ACL para el mismo
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-09-26 13:55:12 +02:00
parent 9d7e12d861
commit c563b07c01
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,51 @@
module.exports = Self => {
Self.remoteMethodCtx('collectionMissingTrash', {
description: 'Modify the amount of a sale throwing it into faults or trash',
accessType: 'WRITE',
accepts: [{
arg: 'saleId',
type: 'number',
required: true,
description: 'The sale id'
},
{
arg: 'quantity',
type: 'number',
required: true,
description: 'The ammount to throw'
},
{
arg: 'isTrash',
type: 'boolean',
required: true,
description: 'trash or fault?'
},
{
arg: 'warehouseId',
type: 'number',
required: true,
description: 'The warehouse Id from wich the items will be removed'
},
{
arg: 'newQuantity',
type: 'number',
required: true,
description: 'The amount that will be left on the original ticket'
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/collectionMissingTrash`,
verb: 'POST'
}
});
Self.collectionMissingTrash = async(saleId, quantity, isTrash, warehouseId, newQuantity) => {
let params = [saleId.args.saleId, quantity, isTrash, warehouseId, newQuantity];
const query = `CALL vn.collection_missingTrash(?)`;
const [result] = await Self.rawSql(query, [params]);
return result;
};
};

View File

@ -3,4 +3,5 @@ module.exports = Self => {
require('../methods/collection/newCollection')(Self);
require('../methods/collection/getSectors')(Self);
require('../methods/collection/setSaleQuantity')(Self);
require('../methods/collection/collectionMissingTrash')(Self);
};

View File

@ -0,0 +1,2 @@
INSERT INTO salix.ACL (model,property,accessType,principalId)
VALUES ('Collection','collectionMissingTrash','*','employee');