const express = require('express'); const router = express.Router(); const filter = require('../utilities/filter'); const select = require('../db/selectDB'); const maxWagon = require('../db/maxWagon'); router.get('/:collectionFk', async(req, res) => { //var shelving = "BCD";///introducida por el usuario O en leida de la bbdd? //var collectionFk = '273449'; const collectionFk = req.params.collectionFk; ticketCollection(collectionFk); res.json({message: 'SUCCESS'}) }); module.exports = router; function ticketCollection(collectionFk){//parametro collectionFk select.select(collectionFk, function(err,data){ maxWagon.maxWagon(collectionFk,function(err,max){ //aqui iria una función para pedir el numero de shelvings correspondientes var shelving = ['ABC','DFG','HIJ'] //if(filter.isShelving(shelving)){ insertTicket(data, shelving, max) //}else{ //console.log("¡MATRICULA INCORRECTA!") //} }); }); } function insertTicket(consultaSql, shelving, max){ const config = require('../config'); const got = require('got'); (async() => { const info = await config.info let key = info.data.token let currentUser = info.data.currentUser; (async() => { for(var i=0;i