diff --git a/src/libs/routes/class.js b/src/libs/routes/class.js index dae41b6ee89d8d2e70421f3f9ba0cc38e305fb6b..a01fa0ab2a1e6e347f994ff24f399835a29dbc48 100644 --- a/src/libs/routes/class.js +++ b/src/libs/routes/class.js @@ -325,7 +325,22 @@ rqfCount.addField({ type: 'boolean', field: 'tempo_integral' } -}).addValue({ +}).addValueToField({ + name: 'school', + table: 'escola', + tableField: ['nome_escola', 'id'], + resultField: ['school_name', 'school_id'], + where: { + relation: '=', + type: 'integer', + field: 'id' + }, + join: { + primary: ['id', 'ano_censo'], + foreign: ['escola_id', 'ano_censo'], + foreignTable: 'turma' + } +}, 'dims').addValueToField({ name: 'school', table: 'escola', tableField: 'nome_escola', @@ -340,7 +355,7 @@ rqfCount.addField({ foreign: ['escola_id', 'ano_censo'], foreignTable: 'turma' } -}); +}, 'filter'); classApp.get('/', rqfCount.parse(), rqfCount.build(), (req, res, next) => { diff --git a/src/libs/routes/teacher.js b/src/libs/routes/teacher.js index a23293de7d7d9343ea435daca95c8016ecb64156..f3b2af7e3504e94eb62d75a4b7974563e68dcdd6 100644 --- a/src/libs/routes/teacher.js +++ b/src/libs/routes/teacher.js @@ -296,7 +296,22 @@ rqf.addField({ foreign: 'escola_municipio_id', foreignTable: 'docente' } -}, 'filter').addValue({ +}, 'filter').addValueToField({ + name: 'school', + table: 'escola', + tableField: ['nome_escola', 'id'], + resultField: ['school_name', 'school_id'], + where: { + relation: '=', + type: 'integer', + field: 'id' + }, + join: { + primary: ['id', 'ano_censo'], + foreign: ['escola_id', 'ano_censo'], + foreignTable: 'docente' + } +}, 'dims').addValueToField({ name: 'school', table: 'escola', tableField: 'nome_escola', @@ -311,7 +326,7 @@ rqf.addField({ foreign: ['escola_id', 'ano_censo'], foreignTable: 'docente' } -}).addValue({ +}, 'filter').addValue({ name: 'location', table: 'docente', tableField: 'cod_localizacao',