Skip to content
Snippets Groups Projects
Commit dfb0ae5f authored by Rafael S Castilho's avatar Rafael S Castilho
Browse files

add youth education route

parent 298bab31
No related branches found
No related tags found
2 merge requests!28Development,!20Jvt viva trabalho
/*
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of SMPPIR-Node.
SMPPIR-Node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SMPPIR-Node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>.
*/
const express = require('express');
const jvt_educacao_ag = express.Router();
const libs = `${process.cwd()}/libs`;
const squel = require('squel');
const query = require(`${libs}/middlewares/query`).query;
const response = require(`${libs}/middlewares/response`);
const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
const rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true,
}).addField({
name: 'dims',
field: true,
where: false,
})
.addValue({
name: 'year',
table: 'jvt_educacao_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo',
},
})
.addValue({
name: 'cor_raca',
table: 'jvt_educacao_ag',
tableField: 'cor_raca',
resultField: 'cor_raca',
where: {
relation: '=',
type: 'integer',
field: 'cor_raca',
},
})
.addValue({
name: 'age',
table: 'jvt_educacao_ag',
tableField: 'idade',
resultField: 'age',
where: {
relation: '=',
type: 'integer',
field: 'idade',
},
})
.addValue({
name: 'max_level',
table: 'jvt_educacao_ag',
tableField: 'maior_nivel',
resultField: 'max_level',
where: {
relation: '=',
type: 'integer',
field: 'maior_nivel',
},
})
.addValue({
name: 'concluiu',
table: 'jvt_educacao_ag',
tableField: 'concluiu_frequentou',
resultField: 'concluiu',
where: {
relation: '=',
type: 'integer',
field: 'concluiu_frequentou',
},
})
.addValue({
name: 'in_escola',
table: 'jvt_educacao_ag',
tableField: 'in_escola',
resultField: 'in_escola',
where: {
relation: '=',
type: 'integer',
field: 'in_escola',
},
})
.addValue({
name: 'frequenta',
table: 'jvt_educacao_ag',
tableField: 'serie_frequenta',
resultField: 'frequenta',
where: {
relation: '=',
type: 'integer',
field: 'serie_frequenta',
},
})
.addValue({
name: 'nivel_escola',
table: 'jvt_educacao_ag',
tableField: 'nivel_escola',
resultField: 'nivel_escola',
where: {
relation: '=',
type: 'integer',
field: 'nivel_escola',
},
})
.addValue({
name: 'uf',
table: 'jvt_educacao_ag',
tableField: 'sgl_uf',
resultField: 'uf',
where: {
relation: '=',
type: 'string',
field: 'uf',
},
})
jvt_educacao_ag.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total')
.from('jvt_educacao_ag');
next();
}, query, response('jvt_educacao_ag'));
module.exports = jvt_educacao_ag;
......@@ -90,6 +90,8 @@ const ciganos_sustentability = require(`${libs}/routes/SMPPIR/ciganos_sustentabi
const youth_jobs = require(`${libs}/routes/SMPPIR/youth_jobs`)
const youth_education = require(`${libs}/routes/SMPPIR/youth_education`)
api.get('/', (req, res) => {
res.json({ msg: 'SMPPIR API is running' });
......@@ -128,6 +130,6 @@ api.use('/ciganos_rights', ciganos_rights);
api.use('/ciganos_culture', ciganos_culture);
api.use('/ciganos_sustentability', ciganos_sustentability);
api.use('/youth_jobs', youth_jobs)
api.use('/youth_education', youth_education)
module.exports = api;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment