Commit 43555fba9f31c5a8d82eeff2bd344d55ead487f9
1 parent
af0fcb1ff4
Exists in
master
no codigo de barras2
Showing
1 changed file
with
4 additions
and
31 deletions
Show diff stats
rutas/articulos.js
| ... | ... | @@ -25,38 +25,11 @@ router.get('/articulos/:page', (req, res) => { |
| 25 | 25 | }) |
| 26 | 26 | .then(data => { |
| 27 | 27 | |
| 28 | - var promisesCodBar = []; | |
| 29 | - | |
| 30 | - data.forEach(articulo => { | |
| 31 | - | |
| 32 | - promisesCodBar.push( | |
| 33 | - knex('CODBAR').where({ | |
| 34 | - CodSec: articulo.get('CodSec'), | |
| 35 | - CodArt: articulo.get('CodArt') | |
| 36 | - }) | |
| 37 | - ); | |
| 38 | - }); | |
| 39 | - | |
| 40 | - Promise.all(promisesCodBar).then((codigoBarra) => { | |
| 41 | - | |
| 42 | - codigoBarra.forEach(codigo => { | |
| 43 | - codigo = codigo[0]; | |
| 44 | - | |
| 45 | - if (codigo) { | |
| 46 | - | |
| 47 | - let articulo = data.filter(art => { | |
| 48 | - return art.get('CodArt') == codigo.CodArt; | |
| 49 | - }); | |
| 50 | - | |
| 51 | - articulo[0].set('codigoBarra', codigo.CodBar); | |
| 52 | - } | |
| 28 | + res.status(200).send( | |
| 29 | + { | |
| 30 | + data: data, | |
| 31 | + pagination: data.pagination, | |
| 53 | 32 | }); |
| 54 | - res.status(200).send( | |
| 55 | - { | |
| 56 | - data: data, | |
| 57 | - pagination: data.pagination, | |
| 58 | - }); | |
| 59 | - }); | |
| 60 | 33 | |
| 61 | 34 | }); |
| 62 | 35 | }); |