Skip to content
Snippets Groups Projects
Commit 7efb7114 authored by ns17's avatar ns17
Browse files

creating indigenous routes (for three pages)"

parent 3cad9e2c
Branches
No related tags found
2 merge requests!48Development,!37creating indigenous routes (for three pages)"
'use strict';
/*
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/>.
*/
var express = require('express');
var cad_unico_count = express.Router();
var libs = process.cwd() + '/libs';
var squel = require('squel');
var query = require(libs + '/middlewares/query').query;
var response = require(libs + '/middlewares/response');
var ReqQueryFields = require(libs + '/middlewares/reqQueryFields');
var rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'indigenas_development_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'family_type',
table: 'indigenas_development_ag',
tableField: 'ind_tipo_familia',
resultField: 'ind_parc_mds_fam',
where: {
relation: '=',
type: 'string',
field: 'ind_tipo_familia'
}
}).addValue({
name: 'cod_home_bolsa_familia',
table: 'indigenas_development_ag',
tableField: 'marca_programa_bolsa_familia',
resultField: 'marc_pbf',
where: {
relation: '=',
type: 'string',
field: 'marca_programa_bolsa_familia'
}
}).addValue({
name: 'cod_agriculture_job',
table: 'indigenas_development_ag',
tableField: 'atividade_extrativista',
resultField: 'cod_agricultura_trab_memb',
where: {
relation: '=',
type: 'string',
field: 'atividade_extrativista'
}
}).addValue({
name: 'per_capita_income',
table: 'indigenas_development_ag',
tableField: 'renda_media',
resultField: 'vlr_renda_media_fam',
where: {
relation: '=',
type: 'float',
field: 'renda_media'
}
}).addValue({
name: 'home_location',
table: 'indigenas_development_ag',
tableField: 'codigo_ibge',
resultField: 'cd_ibge',
where: {
relation: '=',
type: 'string',
field: 'codigo_ibge'
}
}).addValue({
name: 'uf',
table: 'indigenas_development_ag',
tableField: 'sigla_estado',
resultField: 'uf',
where: {
relation: '=',
type: 'string',
field: 'sigla_estado'
}
}).addValue({
name: 'region',
table: 'indigenas_development_ag',
tableField: 'nome_regiao',
resultField: 'region',
where: {
relation: '=',
type: 'string',
field: 'nome_regiao'
}
});
cad_unico_count.get('/', rqf.parse(), rqf.build(), function (req, res, next) {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total').from('indigenas_development_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico_count;
\ No newline at end of file
'use strict';
/*
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/>.
*/
var express = require('express');
var cad_unico = express.Router();
var libs = process.cwd() + '/libs';
var squel = require('squel');
var query = require(libs + '/middlewares/query').query;
var response = require(libs + '/middlewares/response');
var ReqQueryFields = require(libs + '/middlewares/reqQueryFields');
var rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'indigenas_infrastructure_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'family_type',
table: 'indigenas_infrastructure_ag',
tableField: 'ind_tipo_familia',
resultField: 'ind_parc_mds_fam',
where: {
relation: '=',
type: 'string',
field: 'ind_tipo_familia'
}
}).addValue({
name: 'cod_local_home',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_local_domicilio',
resultField: 'cod_local_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_local_domicilio'
}
}).addValue({
name: 'cod_home_lighting',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_iluminacao_domicilio',
resultField: 'cod_iluminacao_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_iluminacao_domicilio'
}
}).addValue({
name: 'cod_home_trash_destiny',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_destino_lixo_domicilio',
resultField: 'cod_destino_lixo_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_destino_lixo_domicilio'
}
}).addValue({
name: 'cod_home_watter_supply',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_abastecimento_agua_domicilio',
resultField: 'cod_abaste_agua_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_abastecimento_agua_domicilio'
}
}).addValue({
name: 'home_type',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_especie_domicilio',
resultField: 'cod_especie_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_especie_domicilio'
}
}).addValue({
name: 'uf',
table: 'indigenas_infrastructure_ag',
tableField: 'sigla_estado',
resultField: 'uf',
where: {
relation: '=',
type: 'string',
field: 'sigla_estado'
}
}).addValue({
name: 'region',
table: 'indigenas_infrastructure_ag',
tableField: 'nome_regiao',
resultField: 'region',
where: {
relation: '=',
type: 'string',
field: 'nome_regiao'
}
}).addValue({
name: 'cod_sanitary_dump',
table: 'indigenas_infrastructure_ag',
tableField: 'cod_escoa_sanitario_domicilio',
resultField: 'cod_escoa_sanitario_domic_fam',
where: {
relation: '=',
type: 'string',
field: 'cod_escoa_sanitario_domic_fam'
}
});
cad_unico.get('/', rqf.parse(), rqf.build(), function (req, res, next) {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total').from('indigenas_infrastructure_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
\ No newline at end of file
'use strict';
/*
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/>.
*/
var express = require('express');
var cad_unico = express.Router();
var libs = process.cwd() + '/libs';
var squel = require('squel');
var query = require(libs + '/middlewares/query').query;
var response = require(libs + '/middlewares/response');
var ReqQueryFields = require(libs + '/middlewares/reqQueryFields');
var rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'indigenas_rights_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'age',
table: 'indigenas_rights_ag',
tableField: 'idade',
resultField: 'idade',
where: {
relation: '=',
type: 'string',
field: 'idade'
}
}).addValue({
name: 'education_families_conclude',
table: 'indigenas_rights_ag',
tableField: 'concluiu_frequentou',
resultField: 'cod_concluiu_frequentou_memb',
where: {
relation: '=',
type: 'string',
field: 'concluiu_frequentou'
}
}).addValue({
name: 'education_families_level',
table: 'indigenas_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: 'indigenas_rights_ag',
tableField: 'curso_frequentou',
resultField: 'cod_curso_frequentou_pessoa_memb',
where: {
relation: '=',
type: 'string',
field: 'curso_frequentou'
}
}).addValue({
name: 'uf',
table: 'indigenas_rights_ag',
tableField: 'sigla_estado',
resultField: 'uf',
where: {
relation: '=',
type: 'string',
field: 'sigla_estado'
}
}).addValue({
name: 'region',
table: 'indigenas_rights_ag',
tableField: 'nome_regiao',
resultField: 'region',
where: {
relation: '=',
type: 'string',
field: 'nome_regiao'
}
}).addValue({
name: 'gender',
table: 'indigenas_rights_ag',
tableField: 'genero',
resultField: 'genero',
where: {
relation: '=',
type: 'string',
field: 'genero'
}
});
cad_unico.get('/', rqf.parse(), rqf.build(), function (req, res, next) {
console.log(req.sql.toString());
req.sql.field('SUM(total) AS Total').from('indigenas_rights_ag');
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
\ No newline at end of file
...@@ -116,6 +116,12 @@ const university = require(`${libs}/routes/university`); ...@@ -116,6 +116,12 @@ const university = require(`${libs}/routes/university`);
const universityTeacher = require(`${libs}/routes/universityTeacher`); const universityTeacher = require(`${libs}/routes/universityTeacher`);
const indigenas_infrastructure = require(`${libs}/routes/indigenas_infrastructure`);
const indigenas_development = require(`${libs}/routes/indigenas_development`);
const indigenas_rights = require(`${libs}/routes/indigenas_rights`);
api.get('/', (req, res) => { api.get('/', (req, res) => {
res.json({ msg: 'SMPPIR API is running' }); res.json({ msg: 'SMPPIR API is running' });
}); });
...@@ -162,5 +168,8 @@ api.use('/education', education) ...@@ -162,5 +168,8 @@ api.use('/education', education)
api.use('/taxa_homicidios', taxa_homicidios) api.use('/taxa_homicidios', taxa_homicidios)
api.use('/traditional_families', traditional_families) api.use('/traditional_families', traditional_families)
api.use('/traditional_families_people', traditional_families_people) api.use('/traditional_families_people', traditional_families_people)
api.use('/indigenas_infrastructure', indigenas_infrastructure)
api.use('/indigenas_development', indigenas_development)
api.use('/indigenas_rights', indigenas_rights)
module.exports = api; module.exports = api;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment