Skip to content
Snippets Groups Projects
Commit 986c7ecb authored by Fernando Gbur dos Santos's avatar Fernando Gbur dos Santos
Browse files

[ADD] Filters route options added

parent 9924c5ed
No related branches found
No related tags found
3 merge requests!417[ADD] Indicator "Taxa de Atendimento Educacional" updated on production!,!416[ADD] Route almost ready, some tests needed. Comments added and filters that...,!414[ADD] Route almost ready, some tests needed. Comments added and filters that...
......@@ -45,9 +45,94 @@ rateSchoolNewApp.use(cache('15 day'));
rateSchoolNewApp.get('/years', (req, res, next) => {
req.sql.from('pnad_novo')
.field('DISTINCT pnad_novo.ano_ref', 'year')
.where('pnad_novo.ano_ref> 2018')
next();
}, query, response('years'));
PnadNovoApp.get('/region', (req, res, next) => {
req.result = []
for (let i = 1; i < 6; i++) {
req.result.push({
id: i, name: id2str.regionCode(i)
});
}
next();
}, response('region'));
PnadNovoApp.get('/cap_code', (req, res, next) => {
req.result = []
for (let i = 11; i < 54; i++) {
if (id2str.capitalCode(i) !== 'Não informado') {
req.result.push({
id: i, name: id2str.capitalCode(i)
});
}
}
req.result.push({id: 99, name: id2str.capitalCode(99)});
next();
}, response('cap_code'));
PnadNovoApp.get('/metro_code', (req, res, next) => {
req.result = []
for (let i = 13; i < 53; i++) {
if (id2str.metroCode(i) !== 'Não informado') {
req.result.push({
id: i, name: id2str.metroCode(i)
});
}
}
req.result.push({id: 99, name: id2str.metroCode(99)});
next();
}, response('metro_code'));
PnadNovoApp.get('/gender', (req, res, next) => {
req.result = []
for (let i = 1; i < 3; i++) {
req.result.push({
id: i, name: id2str.gender(i)
});
}
next();
}, response('gender'));
PnadNovoApp.get('/bolsa_familia', (req, res, next) => {
req.result = []
for (let i = 1; i < 3; i++) {
req.result.push({
id: i, name: id2str.attendsSchool(i)
});
}
req.result.push({id: 9, name: id2str.attendsSchool(9)});
next();
}, response('bolsa_familia'));
PnadNovoApp.get('/state', (req, res, next) => {
req.result = []
for (let i = 11; i < 54; i++) {
if (id2str.stateName(i) !== 'Não declarada') {
req.result.push({
id: i, name: id2str.stateName(i)
});
}
}
req.result.push({id: 99, name: id2str.stateName(99)});
next();
}, response('state'));
PnadNovoApp.get('/income_range', (req, res, next) => {
req.result = []
for (let i = 1; i < 8; i++) {
req.result.push({
id: i, name: id2str.incomeRange(i)
});
}
req.result.push({id: 9, name: id2str.incomeRange(9)});
next();
}, response('income_range'));
rqf.addField({
name: 'filter',
......
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