diff --git a/src/libs/convert/posTraining.js b/src/libs/convert/posTraining.js new file mode 100644 index 0000000000000000000000000000000000000000..12776cd63bfec402082d427db6a1519a8a557b2c --- /dev/null +++ b/src/libs/convert/posTraining.js @@ -0,0 +1,32 @@ +/* +Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of simcaq-node. + +simcaq-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. + +simcaq-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 simcaq-node. If not, see <https://www.gnu.org/licenses/>. +*/ + +module.exports = function posTraining(id) { + switch (id) { + case 1: + return 'Sem pós-graduação'; + case 2: + return 'Especialização'; + case 3: + return 'Mestrado'; + case 4: + return 'Doutorado'; + } +}; diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index 53ad2e9bffd287c8dc453b3fd41cd202830e4cca..cb9a18d6303bf9226028ddbc246a76e01b1ec2b1 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -87,6 +87,7 @@ const nightTime = require(`${libs}/convert/nightTime`); const discipline = require(`${libs}/convert/discipline`); const finishUniversity = require(`${libs}/convert/finishUniversity`); const initialTraining = require(`${libs}/convert/initialTraining`); +const posTraining = require(`${libs}/convert/posTraining`); const ids = { gender_id: gender, @@ -165,7 +166,8 @@ const ids = { arrangement_id: arrangement, discipline: discipline, finish_id: finishUniversity, - initial_training_id: initialTraining + initial_training_id: initialTraining, + pos_training_id: posTraining }; function transform(removeId=false) { @@ -271,5 +273,6 @@ module.exports = { nightTime, discipline, finishUniversity, - initialTraining + initialTraining, + posTraining }; diff --git a/src/libs/routes/teacher.js b/src/libs/routes/teacher.js index 5179ca1fbc8184a66b61575aa5b76a6688fb59a6..c9a3d50a825b5b0469574587f9a62b2174d5784e 100644 --- a/src/libs/routes/teacher.js +++ b/src/libs/routes/teacher.js @@ -182,6 +182,18 @@ teacherApp.get('/ethnic_group', (req, res, next) => { next(); }, response('ethnic_group')); +teacherApp.get('/pos_training', (req, res, next) => { + req.result = []; + for(let i = 1; i <= 4; ++i) { + req.result.push({ + id: i, + name: id2str.posTraining(i) + }); + } + next(); +}, response('pos_training')); + + rqf.addField({ name: 'filter', field: false, @@ -442,6 +454,16 @@ rqf.addField({ type: 'integer', field: 'formacao_inicial_docente' } +}).addValue({ + name: 'pos_training', + table: 'docente', + tableField: 'formacao_pos_docente', + resultField: 'pos_training_id', + where: { + relation: '=', + type: 'integer', + field: 'formacao_pos_docente' + } }); teacherApp.get('/', rqf.parse(), (req, res, next) => {