Compare commits
7 Commits
dev
...
3557-Refac
Author | SHA1 | Date |
---|---|---|
Pau | a7e874ed0d | |
Pau | 586af16392 | |
Pau | e781700d07 | |
Pau | 2e89dd65f6 | |
Pau | 4fefdade69 | |
Pau | 8d2ef655dd | |
Pau | c563b07c01 |
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES
|
||||
('Collection','collectionMissingTrash','WRITE','ALLOW','ROLE','employee');
|
Loading…
Reference in New Issue