From c10a03ff7bf12b274ca517abceb4f17ef4c45c71 Mon Sep 17 00:00:00 2001
From: ppc19 <ppc19@inf.ufpr.br>
Date: Fri, 11 Mar 2022 10:14:16 -0300
Subject: [PATCH] add filters

---
 src/libs/routes/courseStudents.js | 51 +++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js
index edc4a227..f3c67678 100644
--- a/src/libs/routes/courseStudents.js
+++ b/src/libs/routes/courseStudents.js
@@ -120,6 +120,57 @@ rqf.addField({
         table: 'curso_ens_superior'
     }
 })
+.addValue({
+    name: 'mesoregion',
+    table: 'municipio',
+    tableField: ['nome_mesorregiao', 'mesorregiao_id'],
+    resultField: ['mesoregion_name', 'mesoregion_id'],
+    where: {
+        relation: '=',
+        type: 'integer',
+        field: 'mesorregiao_id',
+        table: 'municipio'
+    },
+    join: {
+        primary: 'id',
+        foreign: 'cod_municipio_ies',
+        foreignTable: 'ies_ens_superior'
+    }
+})
+.addValue({
+    name: 'microregion',
+    table: 'municipio',
+    tableField: ['nome_microrregiao', 'microrregiao_id'],
+    resultField: ['microregion_name', 'microregion_id'],
+    where: {
+        relation: '=',
+        type: 'integer',
+        field: 'microrregiao_id',
+        table: 'municipio'
+    },
+    join: {
+        primary: 'id',
+        foreign: 'cod_municipio_ies',
+        foreignTable: 'ies_ens_superior'
+    }
+})
+.addValue({
+    name: 'city',
+    table: 'municipio',
+    tableField: ['id', 'nome'],
+    resultField: ['city_id', 'city_name'],
+    where: {
+        relation: '=',
+        type: 'integer',
+        field: 'id',
+        table: 'municipio'
+    },
+    join: {
+        primary: 'id',
+        foreign: 'cod_municipio_ies',
+        foreignTable: 'ies_ens_superior'
+    }
+})
 
 
 
-- 
GitLab