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

Fix idhme default

parent d812b7cd
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!71Idhme idhml hotfix
Pipeline #
......@@ -123,6 +123,14 @@ rqf.addField({
idhmeApp.get('/', rqf.parse(), (req, res, next) => {
if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) {
res.status(400);
next({
status: 400,
message: 'Wrong/No filter specified'
});
}
if (("city" in req.dims) || ("city" in req.filter)) {
req.sql.from('adh_idh')
.field('adh_idh.idhm_e', 'total')
......@@ -131,7 +139,7 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => {
.group('adh_idh.idhm_e')
.group('adh_idh.ano_censo')
.group('adh_idh.municipio_id');
} else {
} else if (("state" in req.filter) || ("state" in req.dims) && !("city" in req.filter) && !("city" in req.dims)) {
req.sql.from('adh_idh_uf')
.field('adh_idh_uf.idhm_e', 'total')
.field('adh_idh_uf.ano_censo', 'year')
......@@ -139,6 +147,12 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => {
.group('adh_idh_uf.idhm_e')
.group('adh_idh_uf.ano_censo')
.group('adh_idh_uf.estado_id');
} else {
res.status(400);
next({
status: 400,
message: 'Wrong/No filter specified'
});
}
next();
}, rqf.build(), query, id2str.transform(), response('idhme'));
......
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