From 3c71a777bc060e3edf51fd5dc5e78c5f81b9465f Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Wed, 12 Apr 2017 11:54:10 -0300 Subject: [PATCH] Add /education_level and /education_level_mod to /enrollment No tests added though --- src/libs/routes/enrollment.js | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/libs/routes/enrollment.js b/src/libs/routes/enrollment.js index 58ebb200..926b6ce6 100644 --- a/src/libs/routes/enrollment.js +++ b/src/libs/routes/enrollment.js @@ -35,7 +35,7 @@ enrollmentApp.get('/location', (req, res, next) => { next(); }, query, response('location')); -// Returns all educational levels avaible +// Returns all school years available enrollmentApp.get('/school_year', (req, res, next) => { req.sql.from('serie_ano') .field('id') @@ -43,6 +43,22 @@ enrollmentApp.get('/school_year', (req, res, next) => { next(); }, query, response('school_year')); +// Returns all school years available +enrollmentApp.get('/education_level', (req, res, next) => { + req.sql.from('etapa_ensino') + .field('id') + .field('desc_etapa', 'name'); + next(); +}, query, response('education_level')); + +// Returns all school years available +enrollmentApp.get('/education_level_mod', (req, res, next) => { + req.sql.from('etapa_ensino') + .field('id') + .field('nome', 'name'); + next(); +}, query, response('education_level_mod')); + // Returns all adm dependencies enrollmentApp.get('/adm_dependency', (req, res, next) => { req.sql.from('dependencia_adm') @@ -118,6 +134,24 @@ rqf.addField({ relation: '=', type: 'integer' } +}).addValue({ + name: 'education_level', + table: 'matricula', + tableField: 'etapa_ensino_id', + resultField: 'education_level_id', + where: { + relation: '=', + type: 'integer' + } +}).addValue({ + name: 'education_level_mod', + table: 'matricula', + tableField: 'etapas_mod_ensino_segmento_id', + resultField: 'education_level_mod_id', + where: { + relation: '=', + type: 'integer' + } }).addValue({ name: 'region', table: 'regiao', -- GitLab