diff --git a/methods/bindTicketShelving.js b/methods/bindTicketShelving.js index ec249a5..cf3e1f5 100644 --- a/methods/bindTicketShelving.js +++ b/methods/bindTicketShelving.js @@ -5,6 +5,7 @@ const select = require('../db/selectDB'); router.get('/:collectionShelving', async(req, res) => { const collectionShelving = req.params.collectionShelving.split(','); + console.log(collectionShelving); let collectionFk = 273449; ticketShelving(collectionShelving, collectionFk); res.json({message: 'SUCCESS'}); @@ -14,12 +15,15 @@ module.exports = router; function ticketShelving(collectionShelving, collectionFk) {// parametro collectionFk select.select(collectionFk, function(err, data) { - // aqui iria una función para pedir el numero de shelvings correspondientes - insertTicket(data, collectionShelving, max); + console.log(data); + insertTicket(data, collectionShelving); }); } -function insertTicket(consultaSql, shelving, max) { +function insertTicket(consultaSql, shelving) { + console.log(shelving); + console.log('CONSULTASQL:', consultaSql); + console.log('CONSULTASQL_TAMNAÑO:', consultaSql.length); const dataLogIn = require('../server'); const got = require('got'); (async() => { @@ -29,6 +33,7 @@ function insertTicket(consultaSql, shelving, max) { (async() => { for (let i = 0; i < consultaSql.length; i++) { + console.log(i); for (let j = 0; j < consultaSql[i].Level.toString().length; j++) { const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line json: { @@ -53,7 +58,7 @@ function insertTicket(consultaSql, shelving, max) { 'Authorization': key } }); - return true; + console.log(body); } } })();