Commit b49444a8 authored by Henrique Varella Ehrenfried's avatar Henrique Varella Ehrenfried

Merge branch 'SMPPIR_Routes' of gitlab.c3sl.ufpr.br:SMPPIR/SMPPIR-Node into development

parents e1882e94 8872b267
Pipeline #16052 failed with stage
in 60 minutes and 4 seconds
const express = require('express');
const admissionApp = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'shift',
table: 'aluno_ens_superior',
tableField: 'turno_aluno',
where: {
relation: '=',
type: 'string',
field: 'turno_aluno'
}
}).addValue({
name: 'gender',
table: 'aluno_ens_superior',
tableField: 'descricao_genero_aluno',
where: {
relation: '=',
type: 'string',
field: 'descricao_genero_aluno'
}
}).addValue({
name: 'ethnic',
table: 'aluno_ens_superior',
tableField: 'cor_raca_aluno',
where: {
relation: '=',
type: 'string',
field: 'cor_raca_aluno'
}
}).addValue({
name: 'course',
table: 'aluno_ens_superior',
tableField: 'nome_curso',
where: {
relation: '=',
type: 'string',
field: 'nome_curso'
}
}).addValue({
name: 'institution',
table: 'aluno_ens_superior',
tableField: 'nome_ies',
where: {
relation: '=',
type: 'string',
field: 'nome_ies'
}
}).addValue({
name: 'institution_cod',
table: 'aluno_ens_superior',
tableField: 'cod_ies',
where: {
relation: '=',
type: 'integer',
field: 'cod_ies'
}
}).addValue({
name: 'year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'min_year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'cod_offer_location',
table: 'localoferta_ens_superior',
tableField: 'cod_local_oferta',
where: {
relation: '=',
type: 'integer',
field: 'cod_local_oferta'
},
join: {
primary: ['cod_curso','ano_censo'],
foreign: ['cod_curso','ano_censo'],
foreignTable: 'aluno_ens_superior'
}
}).addValue({
name: 'name_offer_location',
table: 'localoferta_ens_superior',
tableField: 'nome',
where: {
relation: '=',
type: 'string',
field: 'nome'
},
join: {
primary: ['cod_curso','ano_censo'],
foreign: ['cod_curso','ano_censo'],
foreignTable: 'aluno_ens_superior'
}
});
admissionApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field("aluno_ens_superior.ano_censo")
.field("COUNT(*) AS total")
.from('aluno_ens_superior')
.where("reserva_vagas = 1")
.where("cod_categoria_administrativa IN (1)")
.where("cod_organizacao_academica IN (1, 4, 5)")
.where("ingressante = 1")
.group("aluno_ens_superior.ano_censo")
.order("aluno_ens_superior.ano_censo")
next();
}, query, response('admission'));
module.exports = admissionApp;
\ No newline at end of file
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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'familias_cadunico',
tableField: 'ano_censo',
resultField: 'ano_censo',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
})
.addValue({
name: 'per_capita_income',
table: 'familias_cadunico',
tableField: 'renda_media',
resultField: 'renda_media',
where: {
relation: '=',
type: 'float',
field: 'renda_media'
}
}).addValue({
name: 'home_type',
table: 'familias_cadunico',
tableField: 'cod_especie_domicilio',
resultField: 'cod_especie_domicilio',
where: {
relation: '=',
type: 'string',
field: 'cod_especie_domicilio'
}
}).addValue({
name: 'home_location',
table: 'pessoas_cadunico',
tableField: 'codigo_ibge',
resultField: 'codigo_ibge',
where: {
relation: '=',
type: 'string',
field: 'codigo_ibge'
},
join: {
primary: ['id_familia'],
foreign: ['id_familia'],
foreignTable: 'familias_cadunico'
}
}).addValue({
name: 'education_families_conclude',
table: 'pessoas_cadunico',
tableField: 'concluiu_frequentou',
resultField: 'concluiu_frequentou',
where: {
relation: '=',
type: 'string',
field: 'concluiu_frequentou'
},
join: {
primary: ['id_familia'],
foreign: ['id_familia'],
foreignTable: 'familias_cadunico'
}
}).addValue({
name: 'education_families_level',
table: 'pessoas_cadunico',
tableField: 'ano_serie_frequentou',
resultField: 'ano_serie_frequentou',
where: {
relation: '=',
type: 'string',
field: 'ano_serie_frequentou'
},
join: {
primary: ['id_familia'],
foreign: ['id_familia'],
foreignTable: 'familias_cadunico'
}
}).addValue({
name: 'education_families',
table: 'pessoas_cadunico',
tableField: 'curso_frequentou',
resultField: 'curso_frequentou',
where: {
relation: '=',
type: 'string',
field: 'curso_frequentou'
},
join: {
primary: ['id_familia'],
foreign: ['id_familia'],
foreignTable: 'familias_cadunico'
}
})
;
cad_unico.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field("COUNT(*) AS Total")
.from("familias_cadunico")
.where('ind_tipo_familia = 203')
next();
}, query, response('cad_unico'));
module.exports = cad_unico;
const express = require('express');
const course = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'curso_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'min_year',
table: 'curso_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'curso_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
});
course.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field('curso_temp.nome_curso')
.from('(SELECT distinct(nome_curso), ano_censo FROM curso_ens_superior) AS curso_temp')
.group('curso_temp.nome_curso')
.order('curso_temp.nome_curso')
next();
}, query, response('social_support'));
module.exports = course;
\ No newline at end of file
const express = require('express');
const institution = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'fies_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'min_year',
table: 'fies_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'fies_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
});
institution.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field("fies_temp.curso")
.from('(SELECT distinct(curso) as curso, ano_censo FROM fies) as fies_temp')
.group("fies_temp.curso")
.order("fies_temp.curso")
next();
}, query, response('courseFIES'));
module.exports = institution;
\ No newline at end of file
const express = require('express');
const institution = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'year',
table: 'prouni_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'min_year',
table: 'prouni_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'prouni_temp',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
});
institution.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field('prouni_temp.nome_curso')
.from('(SELECT distinct(nome_curso), ano_censo FROM prouni) AS prouni_temp')
.group('prouni_temp.nome_curso')
.order('nome_curso')
next();
}, query, response('coursePROUNI'));
module.exports = institution;
\ No newline at end of file
const express = require('express');
const evaderApp = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'cod_offer_location',
table: 'localoferta_ens_superior',
tableField: 'cod_local_oferta',
where: {
relation: '=',
type: 'integer',
field: 'cod_local_oferta'
},
join: {
primary: ['cod_curso','ano_censo'],
foreign: ['cod_curso','ano_censo'],
foreignTable: 'aluno_ens_superior'
}
}).addValue({
name: 'name_offer_location',
table: 'localoferta_ens_superior',
tableField: 'nome',
where: {
relation: '=',
type: 'string',
field: 'nome'
},
join: {
primary: ['cod_curso','ano_censo'],
foreign: ['cod_curso','ano_censo'],
foreignTable: 'aluno_ens_superior',
}
}).addValue({
name: 'shift',
table: 'aluno_ens_superior',
tableField: 'turno_aluno',
where: {
relation: '=',
type: 'string',
field: 'turno_aluno'
}
}).addValue({
name: 'gender',
table: 'aluno_ens_superior',
tableField: 'descricao_genero_aluno',
where: {
relation: '=',
type: 'string',
field: 'descricao_genero_aluno'
}
}).addValue({
name: 'ethnic',
table: 'aluno_ens_superior',
tableField: 'cor_raca_aluno',
where: {
relation: '=',
type: 'string',
field: 'cor_raca_aluno'
}
}).addValue({
name: 'course',
table: 'aluno_ens_superior',
tableField: 'nome_curso',
where: {
relation: '=',
type: 'string',
field: 'nome_curso'
}
}).addValue({
name: 'institution',
table: 'aluno_ens_superior',
tableField: 'nome_ies',
where: {
relation: '=',
type: 'string',
field: 'nome_ies'
}
}).addValue({
name: 'institution_cod',
table: 'aluno_ens_superior',
tableField: 'cod_ies',
where: {
relation: '=',
type: 'integer',
field: 'cod_ies'
}
}).addValue({
name: 'year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'min_year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'aluno_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'region',
table: 'ies_ens_superior',
tableField: 'nome_regiao_ies',
resultField: 'region',
where: {
relation: '=',
type: 'string',
field: 'nome_regiao_ies'
}
}).addValue({
name: 'uf',
table: 'ies_ens_superior',
tableField: 'sigla_uf_ies',
resultField: 'uf',
where: {
relation: '=',
type: 'string',
field: 'sigla_uf_ies'
}
});
evaderApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.field("aluno_ens_superior.ano_censo")
.field("COUNT(*) AS total")
.from('aluno_ens_superior')
.join("ies_ens_superior", "","aluno_ens_superior.cod_ies = ies_ens_superior.cod_ies")
.where("aluno_ens_superior.cod_aluno_situacao IN (4,5,7)")
.where("aluno_ens_superior.reserva_vagas = 1")
.where("aluno_ens_superior.cod_categoria_administrativa IN (1)")
.where("aluno_ens_superior.cod_organizacao_academica IN (1, 4, 5)")
.where("aluno_ens_superior.ano_censo = ies_ens_superior.ano_censo")
.group("aluno_ens_superior.ano_censo")
.order("aluno_ens_superior.ano_censo")
next();
}, query, response('evader'));
module.exports = evaderApp;
\ No newline at end of file
const express = require('express');
const extracurricular_activitiesApp = 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`);
let rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'cod_offer_location',
table: 'localoferta_ens_superior',
tableField: 'cod_local_oferta',
where: {
relation: '=',
type: 'integer',
field: 'id'
},
join: {
primary: ['cod_curso','ano_censo'],
foreign: ['cod_curso','ano_censo'],
foreignTable: 'aluno_ens_superior'
}
}).addValue({
name: 'name_offer_location',
table: 'localoferta_ens_superior',
tableField: 'nome',
where: {
relation: '=',
type: 'string',
field: 'nome'
},