Skip to content
Snippets Groups Projects
Commit 013f20f6 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Change routes to use new database

parent 1d3f95fa
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
...@@ -68,12 +68,19 @@ module.exports = { ...@@ -68,12 +68,19 @@ module.exports = {
gender, gender,
period, period,
schoolYear, schoolYear,
educationLevel,
educationLevelMod,
educationLevelShort,
admDependency, admDependency,
admDependencyPriv,
location, location,
ruralLocation,
ethnicGroup, ethnicGroup,
agreement, agreement,
booleanVariable, booleanVariable,
educationLevel, educationType,
educationLevelMod, incomeLevel,
educationType citySize,
idhmLevel,
stateName
}; };
...@@ -78,11 +78,19 @@ classApp.get('/adm_dependency_detailed', (req, res, next) => { ...@@ -78,11 +78,19 @@ classApp.get('/adm_dependency_detailed', (req, res, next) => {
// Returns all periods avaible // Returns all periods avaible
classApp.get('/period', (req, res, next) => { classApp.get('/period', (req, res, next) => {
req.sql.from('turma_turno') req.result = [];
.field('id') for(let i=1; i <= 3; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.period(i)
});
}
req.result.push({
id: 99,
name: id2str.period(99)
});
next(); next();
}, query, response('period')); }, response('period'));
// Returns integral-time avaible // Returns integral-time avaible
classApp.get('/integral_time', (req, res, next) => { classApp.get('/integral_time', (req, res, next) => {
...@@ -96,11 +104,19 @@ classApp.get('/integral_time', (req, res, next) => { ...@@ -96,11 +104,19 @@ classApp.get('/integral_time', (req, res, next) => {
// Returns all educational levels avaible // Returns all educational levels avaible
classApp.get('/education_level_mod', (req, res, next) => { classApp.get('/education_level_mod', (req, res, next) => {
req.sql.from('etapas_mod_ensino_segmento') req.result = [];
.field('id') for(let i = 1; i <=11; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.educationLevelMod(i)
});
}
req.result.push({
id: 99,
name: id2str.educationLevelMod(99)
});
next(); next();
}, query, response('education_level_mod')); }, response('education_level_mod'));
classApp.get('/education_level_short', (req, res, next) => { classApp.get('/education_level_short', (req, res, next) => {
req.result = [ req.result = [
......
...@@ -62,27 +62,59 @@ enrollmentApp.get('/rural_location', (req, res, next) => { ...@@ -62,27 +62,59 @@ enrollmentApp.get('/rural_location', (req, res, next) => {
// Returns all school years available // Returns all school years available
enrollmentApp.get('/school_year', (req, res, next) => { enrollmentApp.get('/school_year', (req, res, next) => {
req.sql.from('serie_ano') req.result = [];
.field('id') for(let i = 11; i <= 71; ++i) {
.field('nome', 'name'); let obj = {
id: i,
name: id2str.schoolYear(i)
};
if(obj.name !== id2str.schoolYear(99)) {
req.result.push(obj);
}
}
req.result.push({
id: 99,
name: id2str.schoolYear(99)
});
next(); next();
}, query, response('school_year')); }, response('school_year'));
// Returns all school years available // Returns all school years available
enrollmentApp.get('/education_level', (req, res, next) => { enrollmentApp.get('/education_level', (req, res, next) => {
req.sql.from('etapa_ensino') req.result = [];
.field('id') for(let i = 1; i <= 74; ++i) {
.field('desc_etapa', 'name'); let obj = {
id: i,
name: id2str.educationLevel(i)
};
if(obj.name !== id2str.educationLevel(99)) {
req.result.push(obj);
}
}
req.result.push({
id: 99,
name: id2str.educationLevel(99)
});
next(); next();
}, query, response('education_level')); }, response('education_level'));
// Returns all school years available // Returns all school years available
enrollmentApp.get('/education_level_mod', (req, res, next) => { enrollmentApp.get('/education_level_mod', (req, res, next) => {
req.sql.from('etapas_mod_ensino_segmento') req.result = [];
.field('id') for(let i = 1; i <= 11; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.educationLevelMod(i)
});
}
req.result.push({
id: 99,
name: id2str.educationLevelMod(99)
});
next(); next();
}, query, response('education_level_mod')); }, response('education_level_mod'));
enrollmentApp.get('/education_level_short', (req, res, next) => { enrollmentApp.get('/education_level_short', (req, res, next) => {
req.result = [ req.result = [
...@@ -125,18 +157,30 @@ enrollmentApp.get('/gender', (req, res, next) => { ...@@ -125,18 +157,30 @@ enrollmentApp.get('/gender', (req, res, next) => {
// Return ethnic group // Return ethnic group
enrollmentApp.get('/ethnic_group', (req, res, next) => { enrollmentApp.get('/ethnic_group', (req, res, next) => {
req.sql.from('cor_raca') req.result = [];
.field('id') for(let i = 0; i <=5; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.ethnicGroup(i)
});
}
next(); next();
}, query, response('ethnic_group')); }, response('ethnic_group'));
enrollmentApp.get('/period', (req, res, next) => { enrollmentApp.get('/period', (req, res, next) => {
req.sql.from('turma_turno') req.result = [];
.field('id') for(let i = 1; i <= 3; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.period(i)
});
}
req.result.push({
id: 99,
name: id2str.period(99)
});
next(); next();
}, query, response('period')); }, response('period'));
// Returns integral-time avaible // Returns integral-time avaible
enrollmentApp.get('/integral_time', (req, res, next) => { enrollmentApp.get('/integral_time', (req, res, next) => {
......
...@@ -54,11 +54,20 @@ teacherApp.get('/adm_dependency', (req, res, next) => { ...@@ -54,11 +54,20 @@ teacherApp.get('/adm_dependency', (req, res, next) => {
}, query, response('adm_dependency')); }, query, response('adm_dependency'));
teacherApp.get('/education_level_mod', (req, res, next) => { teacherApp.get('/education_level_mod', (req, res, next) => {
req.sql.from('etapas_mod_ensino_segmento') req.result = [];
.field('id') for(let i = 1; i <= 11; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.educationLevelMod(i)
});
}
req.result.push({
id: 99,
name: id2str.educationLevelMod(99)
});
next(); next();
}, query, response('education_level_mod')); }, response('education_level_mod'));
teacherApp.get('/education_level_short', (req, res, next) => { teacherApp.get('/education_level_short', (req, res, next) => {
req.result = [ req.result = [
...@@ -115,11 +124,15 @@ teacherApp.get('/gender', (req, res, next) => { ...@@ -115,11 +124,15 @@ teacherApp.get('/gender', (req, res, next) => {
}, response('gender')); }, response('gender'));
teacherApp.get('/ethnic_group', (req, res, next) => { teacherApp.get('/ethnic_group', (req, res, next) => {
req.sql.from('cor_raca') req.result = [];
.field('id') for(let i = 0; i <=5; ++i) {
.field('nome', 'name'); req.result.push({
id: i,
name: id2str.ethnicGroup(i)
});
}
next(); next();
}, query, response('ethnic_group')); }, response('ethnic_group'));
rqf.addField({ rqf.addField({
name: 'filter', name: 'filter',
......
...@@ -294,7 +294,7 @@ describe('request teachers', () => { ...@@ -294,7 +294,7 @@ describe('request teachers', () => {
}); });
}); });
it('should list enrollment with dimension education_level_short', (done) => { it('should list teacher with dimension education_level_short', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/teacher?dims=education_level_short') .get('/api/v1/teacher?dims=education_level_short')
.end((err, res) => { .end((err, res) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment