Skip to content
Snippets Groups Projects
Commit ffe11074 authored by tgcl21's avatar tgcl21
Browse files

Starter query works

parent 77ea9f08
No related branches found
No related tags found
2 merge requests!502Development,!492Indicador Número de Matrículas do Ensino Superior (novo)
...@@ -172,16 +172,12 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen ...@@ -172,16 +172,12 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen
const iliteracyRate = require(`${libs}/routes_v1/iliteracyRate`); const iliteracyRate = require(`${libs}/routes_v1/iliteracyRate`);
// comentei para ver se o api.get abaixo ia dar certo (nao deu) // comentei para ver se o api.get abaixo ia dar certo (nao deu)
// const superiorEnrollmentAggregate = require(`${libs}/routes_v1/superiorEnrollmentAggregate`); const superiorEnrollmentAggregate = require(`${libs}/routes_v1/superiorEnrollmentAggregate`);
api.get('/', (req, res) => { api.get('/', (req, res) => {
res.json({ msg: 'SimCAQ API v1 is running' }); res.json({ msg: 'SimCAQ API v1 is running' });
}); });
api.get('/superior_enrollment_aggregate', (req, res) => {
res.json({ msg: 'oi' });
})
// mount API routes_v1 // mount API routes_v1
api.use('/test', test); api.use('/test', test);
api.use('/user', user); api.use('/user', user);
...@@ -251,7 +247,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax) ...@@ -251,7 +247,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax)
api.use('/basic_education_conclusion', basicEducationConclusion); api.use('/basic_education_conclusion', basicEducationConclusion);
api.use('/adjusted_liquid_frequency', adjustedLiquidFrequency); api.use('/adjusted_liquid_frequency', adjustedLiquidFrequency);
api.use('/iliteracy_rate', iliteracyRate); api.use('/iliteracy_rate', iliteracyRate);
// api.use('/superior_enrollment_aggregate', superiorEnrollmentAggregate); api.use('/superior_enrollment_aggregate', superiorEnrollmentAggregate);
//Publication //Publication
api.use('/publication', publication); api.use('/publication', publication);
......
...@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. ...@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/ */
const express = require('express'); const express = require('express');
const { result } = require('lodash'); const { result } = require('lodash');
const superiorEnrollmentAggregateApp = express.Router(); const superiorEnrollmentAggregateApp = express.Router();
...@@ -237,277 +238,277 @@ let rqf = new ReqQueryFields(); ...@@ -237,277 +238,277 @@ let rqf = new ReqQueryFields();
// }, response('special_education')); // }, response('special_education'));
// rqf.addField({ rqf.addField({
// name: 'filter', name: 'filter',
// field: false, field: false,
// where: true where: true
// }).addField({ }).addField({
// name: 'dims', name: 'dims',
// field: true, field: true,
// where: false where: false
// }).addValue({ }).addValue({
// name: 'adm_dependency', name: 'adm_dependency',
// table: 'escola', table: 'escola',
// tableField: 'dependencia_adm_id', tableField: 'dependencia_adm_id',
// resultField: 'adm_dependency_id', resultField: 'adm_dependency_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'dependencia_adm_id' field: 'dependencia_adm_id'
// } }
// }).addValue({ }).addValue({
// name: 'adm_dependency_detailed', name: 'adm_dependency_detailed',
// table: 'escola', table: 'escola',
// tableField: 'dependencia_adm_priv', tableField: 'dependencia_adm_priv',
// resultField: 'adm_dependency_detailed_id', resultField: 'adm_dependency_detailed_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'dependencia_adm_priv' field: 'dependencia_adm_priv'
// } }
// }).addValue({ }).addValue({
// name: 'education_level_mod', name: 'education_level_mod',
// table: 'escola', table: 'escola',
// tableField: 'etapas_mod_ensino_segmento_id', tableField: 'etapas_mod_ensino_segmento_id',
// resultField: 'education_level_mod_id', resultField: 'education_level_mod_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'etapas_mod_ensino_segmento_id' field: 'etapas_mod_ensino_segmento_id'
// } }
// }).addValue({ }).addValue({
// name:'integral_time', name:'integral_time',
// table: 'escola', table: 'escola',
// tableField: 'tempo_integral', tableField: 'tempo_integral',
// resultField: 'integral_time_id', resultField: 'integral_time_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'tempo_integral' field: 'tempo_integral'
// } }
// }).addValue({ }).addValue({
// name: 'education_level_short', name: 'education_level_short',
// table: 'escola', table: 'escola',
// tableField: 'etapa_resumida', tableField: 'etapa_resumida',
// resultField: 'education_level_short_id', resultField: 'education_level_short_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'etapa_resumida' field: 'etapa_resumida'
// } }
// }).addValue({ }).addValue({
// name: 'region', name: 'region',
// table: 'regiao', table: 'regiao',
// tableField: ['nome', 'id'], tableField: ['nome', 'id'],
// resultField: ['region_name', 'region_id'], resultField: ['region_name', 'region_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'regiao_id', foreign: 'regiao_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }).addValue({ }).addValue({
// name: 'mesoregion', name: 'mesoregion',
// table: 'municipio', table: 'municipio',
// tableField: ['nome_mesorregiao', 'mesorregiao_id'], tableField: ['nome_mesorregiao', 'mesorregiao_id'],
// resultField: ['mesoregion_name', 'mesoregion_id'], resultField: ['mesoregion_name', 'mesoregion_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'mesorregiao_id', field: 'mesorregiao_id',
// table: 'municipio' table: 'municipio'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'municipio_id', foreign: 'municipio_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }).addValue({ }).addValue({
// name: 'microregion', name: 'microregion',
// table: 'municipio', table: 'municipio',
// tableField: ['nome_microrregiao', 'microrregiao_id'], tableField: ['nome_microrregiao', 'microrregiao_id'],
// resultField: ['microregion_name', 'microregion_id'], resultField: ['microregion_name', 'microregion_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'microrregiao_id', field: 'microrregiao_id',
// table: 'municipio' table: 'municipio'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'municipio_id', foreign: 'municipio_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }).addValue({ }).addValue({
// name: 'min_year', name: 'min_year',
// table: 'escola', table: 'escola',
// tableField: 'ano_censo', tableField: 'ano_censo',
// resultField: 'year', resultField: 'year',
// where: { where: {
// relation: '>=', relation: '>=',
// type: 'integer', type: 'integer',
// field: 'ano_censo', field: 'ano_censo',
// }, },
// }).addValue({ }).addValue({
// name: 'max_year', name: 'max_year',
// table: 'escola', table: 'escola',
// tableField: 'ano_censo', tableField: 'ano_censo',
// resultField: 'year', resultField: 'year',
// where: { where: {
// relation: '<=', relation: '<=',
// type: 'integer', type: 'integer',
// field: 'ano_censo', field: 'ano_censo',
// }, },
// }).addValueToField({ }).addValueToField({
// name: 'state', name: 'state',
// table: 'estado', table: 'estado',
// tableField: ['nome', 'id'], tableField: ['nome', 'id'],
// resultField: ['state_name', 'state_id'], resultField: ['state_name', 'state_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'estado_id', foreign: 'estado_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'dims').addValueToField({ }, 'dims').addValueToField({
// name: 'state', name: 'state',
// table: 'estado', table: 'estado',
// tableField: 'nome', tableField: 'nome',
// resultField: 'state_name', resultField: 'state_name',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'estado_id', foreign: 'estado_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'filter').addValueToField({ }, 'filter').addValueToField({
// name: 'city', name: 'city',
// table: 'municipio', table: 'municipio',
// tableField: ['nome', 'id'], tableField: ['nome', 'id'],
// resultField: ['city_name', 'city_id'], resultField: ['city_name', 'city_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'municipio_id', foreign: 'municipio_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'dims').addValueToField({ }, 'dims').addValueToField({
// name: 'city', name: 'city',
// table: 'municipio', table: 'municipio',
// tableField: 'nome', tableField: 'nome',
// resultField: 'city_name', resultField: 'city_name',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: 'id', primary: 'id',
// foreign: 'municipio_id', foreign: 'municipio_id',
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'filter').addValueToField({ }, 'filter').addValueToField({
// name: 'school', name: 'school',
// table: 'escola', table: 'escola',
// tableField: ['nome_escola', 'id'], tableField: ['nome_escola', 'id'],
// resultField: ['school_name', 'school_id'], resultField: ['school_name', 'school_id'],
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: ['id', 'ano_censo'], primary: ['id', 'ano_censo'],
// foreign: ['escola_id', 'ano_censo'], foreign: ['escola_id', 'ano_censo'],
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'dims').addValueToField({ }, 'dims').addValueToField({
// name: 'locale_id', name: 'locale_id',
// table: 'escola', table: 'escola',
// tableField: 'localizacao_id', tableField: 'localizacao_id',
// resultField: 'locale_id', resultField: 'locale_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'localizacao_id' field: 'localizacao_id'
// } }
// }, 'dims').addValueToField({ }, 'dims').addValueToField({
// name: 'school_id', name: 'school_id',
// table: 'escola', table: 'escola',
// tableField: 'id', tableField: 'id',
// resultField: 'school_id', resultField: 'school_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: ['id', 'ano_censo'], primary: ['id', 'ano_censo'],
// foreign: ['escola_id', 'ano_censo'], foreign: ['escola_id', 'ano_censo'],
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'dims').addValueToField({ }, 'dims').addValueToField({
// name: 'school', name: 'school',
// table: 'escola', table: 'escola',
// tableField: 'nome_escola', tableField: 'nome_escola',
// resultField: 'school_name', resultField: 'school_name',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'id' field: 'id'
// }, },
// join: { join: {
// primary: ['id', 'ano_censo'], primary: ['id', 'ano_censo'],
// foreign: ['escola_id', 'ano_censo'], foreign: ['escola_id', 'ano_censo'],
// foreignTable: 'escola' foreignTable: 'escola'
// } }
// }, 'filter').addValue({ }, 'filter').addValue({
// name: 'location', name: 'location',
// table: 'escola', table: 'escola',
// tableField: 'localizacao_id', tableField: 'localizacao_id',
// resultField: 'location_id', resultField: 'location_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'localizacao_id' field: 'localizacao_id'
// } }
// }).addValue({ }).addValue({
// name: 'diff_location', name: 'diff_location',
// table: 'escola', table: 'escola',
// tableField: 'localizacao_diferenciada_par', tableField: 'localizacao_diferenciada_par',
// resultField: 'diff_location_id', resultField: 'diff_location_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'localizacao_diferenciada_par', field: 'localizacao_diferenciada_par',
// } }
// }).addValue({ }).addValue({
// name: 'government_agreement', name: 'government_agreement',
// table: 'escola', table: 'escola',
// tableField: 'dependencia_convenio_publico', tableField: 'dependencia_convenio_publico',
// resultField: 'government_agreement_id', resultField: 'government_agreement_id',
// where: { where: {
// relation: '=', relation: '=',
// type: 'integer', type: 'integer',
// field: 'dependencia_convenio_publico' field: 'dependencia_convenio_publico'
// } }
// }); });
superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...@@ -521,6 +522,6 @@ superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, nex ...@@ -521,6 +522,6 @@ superiorEnrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, nex
console.log(req.sql.toString()); console.log(req.sql.toString());
next(); next();
}, id2str.transform(false), response('superiorEnrollmentAggregate')); }, query, id2str.transform(false), response('superior_enrollment_aggregate'));
module.exports = superiorEnrollmentAggregateApp; module.exports = superiorEnrollmentAggregateApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment