Skip to content
Snippets Groups Projects
Commit 3065cae1 authored by Gabriel Ruschel's avatar Gabriel Ruschel
Browse files

Right result query

parent 20a3da26
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!91Siope route
Pipeline #
......@@ -46,7 +46,7 @@ siopeApp.get('/years', (req, res, next) => {
rqf.addField({
name: 'filter',
field: false,
field: true,
where: true
}).addField({
name: 'dims',
......@@ -71,8 +71,8 @@ rqf.addField({
}).addValue({
name: 'state',
table: 'estado',
tableField: 'nome',
resultField: 'state_name',
tableField: ['id','nome','sigla'],
resultField: ['state_id','state_name','state_abbreviation'],
where: {
relation: '=',
type: 'integer',
......@@ -149,15 +149,14 @@ siopeApp.get('/', rqf.parse(), (req, res, next) => {
next();
}, rqf.multibuild(), multiQuery, (req, res, next) => {
let result = {}
if ('state' in req.filter) {
req.result[req.queryIndex.siopeUf].forEach((item) => {
let keys = Object.keys(item);
keys.forEach((key) => {
result[key] = item[key];
});
});
}
let result = []
req.result[req.queryIndex.siopeUf].forEach((item) => {
result.push(item)
});
req.result[req.queryIndex.siopeMun].forEach((item) => {
result.push(item)
});
req.result = result;
next();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment