Skip to content
Snippets Groups Projects
Commit c15f2679 authored by Edu Trevisan's avatar Edu Trevisan
Browse files

Add new routes for ciganos_ag

parent 2ec92ba5
Branches
No related tags found
1 merge request!16Development
/*
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 cad_unico = 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: 'ciganos_culture_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo',
},
})
.addValue({
name: 'family_type',
table: 'ciganos_culture_ag',
tableField: 'ind_tipo_familia',
resultField: 'ind_parc_mds_fam',
where: {
relation: '=',
type: 'string',
field: 'ind_tipo_familia',
},
})
.addValue({
name:'cod_local_home',
table:'ciganos_culture_ag',
tableField:'cod_local_domicilio',
resultField:'cod_local_domic_fam',
where: {
relation:'=',
type:'string',
field:'cod_local_domicilio',
},
})
.addValue({
name: 'home_type',
table: 'ciganos_culture_ag',
tableField: 'cod_especie_domicilio',
resultField: 'cod_especie_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_especie_domicilio',
},
})
.addValue({
name: 'home_location',
table: 'ciganos_culture_ag',
tableField: 'codigo_ibge',
resultField: 'cd_ibge',
where: {
relation: '=',
type: 'string',
field: 'codigo_ibge',
},
})
;
cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total')
.from('ciganos_culture_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
/*
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 cad_unico = 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: 'ciganos_rights_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo',
},
})
.addValue({
name: 'family_type',
table: 'ciganos_rights_ag',
tableField: 'ind_tipo_familia',
resultField: 'ind_parc_mds_fam',
where: {
relation: '=',
type: 'string',
field: 'ind_tipo_familia',
},
})
.addValue({
name: 'education_families_conclude',
table: 'ciganos_rights_ag',
tableField: 'concluiu_frequentou',
resultField: 'cod_concluiu_frequentou_memb',
where: {
relation: '=',
type: 'string',
field: 'concluiu_frequentou',
},
})
.addValue({
name: 'education_families_level',
table: 'ciganos_rights_ag',
tableField: 'ano_serie_frequentou',
resultField: 'cod_ano_serie_frequentou_memb',
where: {
relation: '=',
type: 'string',
field: 'ano_serie_frequentou',
},
})
.addValue({
name: 'education_families',
table: 'ciganos_rights_ag',
tableField: 'curso_frequentou',
resultField: 'cod_curso_frequentou_pessoa_memb',
where: {
relation: '=',
type: 'string',
field: 'curso_frequentou',
},
})
;
cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total')
.from('ciganos_rights_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
/*
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 cad_unico = 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: 'ciganos_sustentability_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo',
},
})
.addValue({
name: 'family_type',
table: 'ciganos_sustentability_ag',
tableField: 'ind_tipo_familia',
resultField: 'ind_parc_mds_fam',
where: {
relation: '=',
type: 'string',
field: 'ind_tipo_familia',
},
})
.addValue({
name: 'per_capita_income',
table: 'ciganos_sustentability_ag',
tableField: 'renda_media',
resultField: 'vlr_renda_media_fam',
where: {
relation: '=',
type: 'float',
field: 'renda_media',
},
})
;
cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total')
.from('ciganos_sustentability_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
......@@ -165,6 +165,11 @@ const african_sustentability = require(`${libs}/routes/SMPPIR/african_sustentabi
const quilombola_metrics = require(`${libs}/routes/SMPPIR/quilombola_metrics`)
const ciganos_rights = require(`${libs}/routes/SMPPIR/ciganos_rights`)
const ciganos_culture = require(`${libs}/routes/SMPPIR/ciganos_culture`)
const ciganos_sustentability = require(`${libs}/routes/SMPPIR/ciganos_sustentability`)
//const eixo_2_count = require(`${libs}/routes/SMPPIR/eixo_2_count`)
......@@ -245,6 +250,9 @@ api.use('/african_rights', african_rights);
api.use('/african_culture', african_culture);
api.use('/african_sustentability', african_sustentability);
api.use(`/quilombola_metrics`,quilombola_metrics)
api.use('/ciganos_rights', ciganos_rights);
api.use('/ciganos_culture', ciganos_culture);
api.use('/ciganos_sustentability', ciganos_sustentability);
//api.use('/eixo_2_count', eixo_2_count)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment