Commit 9d0c0ea7dda6c2c38c5e0d29814709c4021e1f77
Exists in
master
and in
2 other branches
Merge branch 'master' into 'master'
Master See merge request !3
Showing
1 changed file
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 | }); |