diff --git a/src/libs/routes/location.js b/src/libs/routes/location.js index 7a870e5f1422636341a3d7bd1c77938851191791..159b1dbd6ae129e51c60be277588d4f38224dd16 100644 --- a/src/libs/routes/location.js +++ b/src/libs/routes/location.js @@ -74,7 +74,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { const populationQry = squel.select() .field('\'Brasil\'', 'name') .field('SUM(populacao)', 'population') - .field('ibge_populacao.ano_censo') + .field('ibge_populacao.ano_censo', 'census_year') .from('ibge_populacao') .where(`ibge_populacao.ano_censo IN (${populationYearQry.toString()})`) .group('ibge_populacao.ano_censo'); @@ -86,7 +86,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { const pibQry = squel.select() .field('\'Brasil\'', 'name') .field('AVG(ibge_pib.pib_per_capita)', 'gdp_per_capita') - .field('ibge_pib.ano_censo') + .field('ibge_pib.ano_censo', 'census_year') .from('ibge_pib') .where(`ibge_pib.ano_censo IN (${pibYearQry.toString()})`) .group('ibge_pib.ano_censo'); @@ -98,7 +98,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { const idhQry = squel.select() .field('\'Brasil\'', 'name') .field('AVG(idhm)', 'idhm') - .field('adh_idh.ano_censo') + .field('adh_idh.ano_censo', 'census_year') .from('adh_idh') .where(`adh_idh.ano_censo IN (${idhYearQry.toString()})`) .group('adh_idh.ano_censo'); @@ -110,7 +110,7 @@ locationApp.get('/sociodemographic', (req, res, next) => { const analfabQry = squel.select() .field('\'Brasil\'', 'name') .field('AVG(t_analf15m)', 'analfabetism') - .field('adh_analfabetismo.ano_censo') + .field('adh_analfabetismo.ano_censo', 'census_year') .from('adh_analfabetismo') .where(`adh_analfabetismo.ano_censo IN (${analfabYearQry.toString()})`) .group('adh_analfabetismo.ano_censo'); @@ -122,13 +122,13 @@ locationApp.get('/sociodemographic', (req, res, next) => { const giniQry = squel.select() .field('\'Brasil\'', 'name') .field('AVG(gini)', 'gini') - .field('adh_gini.ano_censo') + .field('adh_gini.ano_censo', 'census_year') .from('adh_gini') .where(`adh_gini.ano_censo IN (${giniYearQry.toString()})`) .group('adh_gini.ano_censo'); // map query objects to their respective response labels - const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; + const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; // wait until all queries finish or one of them fail Promise.all(dbExecAll(querySet)).then((queryResults) => { @@ -248,7 +248,7 @@ locationApp.get('/sociodemographic/region/:id', (req, res, next) => { .group('adh_gini.ano_censo') .order('regiao.nome'); // map query objects to their respective response labels - const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; + const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; // wait until all queries finish or one of them fail Promise.all(dbExecAll(querySet)).then((queryResults) => { @@ -358,7 +358,7 @@ locationApp.get('/sociodemographic/state/:id', (req, res, next) => { .group('adh_gini.ano_censo') .order('estado.nome'); // map query objects to their respective response labels - const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; + const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; // wait until all queries finish or one of them fail Promise.all(dbExecAll(querySet)).then((queryResults) => { @@ -458,7 +458,7 @@ locationApp.get('/sociodemographic/city/:id', (req, res, next) => { .group('adh_gini.ano_censo') .order('municipio.nome'); // map query objects to their respective response labels - const queryLabels = [ "population", "pib", "idh", "analfab", "gini" ]; + const queryLabels = [ "population", "gdp", "idh", "analfab", "gini" ]; const querySet = [ populationQry, pibQry, idhQry, analfabQry, giniQry ]; // wait until all queries finish or one of them fail Promise.all(dbExecAll(querySet)).then((queryResults) => {