From f2389442b024895d2ed73ab9a29fdfa9c58c74c7 Mon Sep 17 00:00:00 2001
From: Nicollas <ns17@inf.ufpr.br>
Date: Tue, 3 Nov 2020 10:28:12 -0300
Subject: [PATCH] adding uf/region and quotas filters

---
 src/libs/routes/SMPPIR/admission.js      | 22 ++++++++++++++++
 src/libs/routes/SMPPIR/social_support.js | 33 ++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/src/libs/routes/SMPPIR/admission.js b/src/libs/routes/SMPPIR/admission.js
index 80245eb2..65bfea2a 100644
--- a/src/libs/routes/SMPPIR/admission.js
+++ b/src/libs/routes/SMPPIR/admission.js
@@ -142,6 +142,28 @@ rqf.addField({
         type: 'integer',
         field: 'ano_censo',
     },
+})
+.addValue({
+    name: 'region',
+    table: 'admission_ag',
+    tableField: 'nome_regiao_ies',
+    resultField: 'region',
+    where: {
+        relation: '=',
+        type: 'string',
+        field: 'nome_regiao_ies',
+    },
+})
+.addValue({
+    name: 'uf',
+    table: 'admission_ag',
+    tableField: 'sigla_uf_ies',
+    resultField: 'uf',
+    where: {
+        relation: '=',
+        type: 'string',
+        field: 'sigla_uf_ies',
+    },
 });
 
 admissionApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
diff --git a/src/libs/routes/SMPPIR/social_support.js b/src/libs/routes/SMPPIR/social_support.js
index 4a575264..6d55304f 100644
--- a/src/libs/routes/SMPPIR/social_support.js
+++ b/src/libs/routes/SMPPIR/social_support.js
@@ -177,6 +177,17 @@ rqf.addField({
         field: 'apoio_transporte',
     },
 })
+.addValue({
+    name: 'quota',
+    table: 'social_support_ag',
+    tableField: 'reserva_vagas',
+    resultField: 'reserva_vagas',
+    where: {
+        relation: '=',
+        type: 'string',
+        field: 'reserva_vagas',
+    },
+})
 .addValue({
     name: 'year',
     table: 'social_support_ag',
@@ -209,6 +220,28 @@ rqf.addField({
         type: 'integer',
         field: 'ano_censo',
     },
+})
+.addValue({
+    name: 'region',
+    table: 'social_support_ag',
+    tableField: 'nome_regiao_ies',
+    resultField: 'region',
+    where: {
+        relation: '=',
+        type: 'string',
+        field: 'nome_regiao_ies',
+    },
+})
+.addValue({
+    name: 'uf',
+    table: 'social_support_ag',
+    tableField: 'sigla_uf_ies',
+    resultField: 'uf',
+    where: {
+        relation: '=',
+        type: 'string',
+        field: 'sigla_uf_ies',
+    },
 });
 
 social_supportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
-- 
GitLab