modified method to recieve params

This commit is contained in:
Pau 2022-09-28 07:21:43 +02:00
parent 8d2ef655dd
commit 4fefdade69
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('collectionMissingTrash', { Self.remoteMethod('collectionMissingTrash', {
description: 'Modify the amount of a sale throwing it into faults or trash', description: 'Modify the amount of a sale throwing it into faults or trash',
accessType: 'WRITE', accessType: 'WRITE',
accepts: [{ accepts: [{
@ -42,9 +42,10 @@ module.exports = Self => {
} }
}); });
Self.collectionMissingTrash = async function missingTrash(saleId, quantity, isTrash, warehouseId, newQuantity) { Self.collectionMissingTrash = async(saleId, quantity, isTrash, warehouseId, newQuantity) => {
params = [saleId, quantity, isTrash, warehouseId, newQuantity];
const query = `CALL vn.collection_missingTrash(?,?,?,?,?)`; const query = `CALL vn.collection_missingTrash(?,?,?,?,?)`;
const [result] = await Self.rawSql(query, [saleId.args.saleId, quantity, isTrash, warehouseId, newQuantity]); const [result] = await Self.rawSql(query, [params]);
return result; return result;
}; };
}; };