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

:art: Refactor squel in /enrollment

parent 9a3857c6
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
...@@ -20,8 +20,7 @@ const parseParams = require(`${libs}/middlewares/parseParams`); ...@@ -20,8 +20,7 @@ const parseParams = require(`${libs}/middlewares/parseParams`);
// Complete range of the enrollments dataset. // Complete range of the enrollments dataset.
// Returns a tuple of start and ending years of the complete enrollments dataset. // Returns a tuple of start and ending years of the complete enrollments dataset.
enrollmentApp.get('/year_range', (req, res, next) => { enrollmentApp.get('/year_range', (req, res, next) => {
req.sql = squel.select() req.sql.from('turmas')
.from('turmas')
.field('MIN(turmas.ano_censo)', 'start_year') .field('MIN(turmas.ano_censo)', 'start_year')
.field('MAX(turmas.ano_censo)', 'end_year'); .field('MAX(turmas.ano_censo)', 'end_year');
...@@ -30,8 +29,7 @@ enrollmentApp.get('/year_range', (req, res, next) => { ...@@ -30,8 +29,7 @@ enrollmentApp.get('/year_range', (req, res, next) => {
// Returns all educational levels avaible // Returns all educational levels avaible
enrollmentApp.get('/education_level', (req, res, next) => { enrollmentApp.get('/education_level', (req, res, next) => {
req.sql = squel.select() req.sql.from('etapa_ensino')
.from('etapa_ensino')
.field('pk_etapa_ensino_id', 'id') .field('pk_etapa_ensino_id', 'id')
.field('desc_etapa', 'name'); .field('desc_etapa', 'name');
...@@ -40,8 +38,7 @@ enrollmentApp.get('/education_level', (req, res, next) => { ...@@ -40,8 +38,7 @@ enrollmentApp.get('/education_level', (req, res, next) => {
// Returns all adm dependencies // Returns all adm dependencies
enrollmentApp.get('/adm_dependency', (req, res, next) => { enrollmentApp.get('/adm_dependency', (req, res, next) => {
req.sql = squel.select() req.sql.from('dependencia_adms')
.from('dependencia_adms')
.field('pk_dependencia_adm_id', 'id') .field('pk_dependencia_adm_id', 'id')
.field('nome', 'name'); .field('nome', 'name');
......
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