Compare commits

...

7 Commits

Author SHA1 Message Date
Pau a7e874ed0d Modified the SQL query, error now on the procedure
gitea/salix/pipeline/head There was a failure building this commit Details
2022-09-28 12:48:17 +02:00
Pau 586af16392 Removed file with incorrect name
gitea/salix/pipeline/head There was a failure building this commit Details
2022-09-28 07:24:13 +02:00
Pau e781700d07 Changed the name to avoid DB errors 2022-09-28 07:23:47 +02:00
Pau 2e89dd65f6 Modified how the params are passed to the DB 2022-09-28 07:23:10 +02:00
Pau 4fefdade69 modified method to recieve params 2022-09-28 07:21:43 +02:00
Pau 8d2ef655dd Modified the method, now the error is on the DB
gitea/salix/pipeline/head There was a failure building this commit Details
2022-09-27 08:06:35 +02:00
Pau c563b07c01 Añadido collectionMissingTrash y ACL para el mismo
gitea/salix/pipeline/head There was a failure building this commit Details
2022-09-26 13:55:12 +02:00
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,51 @@
module.exports = Self => {
Self.remoteMethod('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, 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,3 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES
('Collection','collectionMissingTrash','WRITE','ALLOW','ROLE','employee');