diff --git a/back/methods/collection/collectionFaults.js b/back/methods/collection/collectionFaults.js new file mode 100644 index 000000000..b39e9f2d2 --- /dev/null +++ b/back/methods/collection/collectionFaults.js @@ -0,0 +1,35 @@ +module.exports = Self => { + Self.remoteMethodCtx('collectionFaults', { + description: 'Update sale of a collection', + accessType: 'WRITE', + accepts: [{ + arg: 'shelvingFk', + type: 'Number', + required: true, + description: 'The sale id' + }, { + arg: 'quantity', + type: 'Number', + required: true, + description: 'The quantity to sale' + }, { + arg: 'itemFk', + type: 'Number', + required: true, + description: 'The ticket id' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/collectionFaults`, + verb: 'POST' + } + }); + + Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => { + query = `vn.collection_faults(?,?,?)`; + return await Self.rawSql(query, [shelvingFk, quantity, itemFk]); + }; +}; diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/collectionNew.js index 59830a08b..6e248f640 100644 --- a/back/methods/collection/collectionNew.js +++ b/back/methods/collection/collectionNew.js @@ -45,6 +45,9 @@ module.exports = Self => { query = `CALL vn.collectionPlacement_get(?)`; const [placements] = await Self.rawSql(query, [collectionFk]); + query = `CALL vn.collectionSticker_print(?,?)`; + // await Self.rawSql(query, [collectionFk, sectorFk]); + return makeCollection(tickets, sales, placements); }; diff --git a/back/models/collection.js b/back/models/collection.js index 9f944d72f..aad0b4196 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/collection/collectionNew')(Self); require('../methods/collection/getSectors')(Self); require('../methods/collection/collectionUpdateSale')(Self); + require('../methods/collection/collectionFaults')(Self); };