From 9bf441c3f31566cf71e4f5de1479b9a2e0037576 Mon Sep 17 00:00:00 2001
From: Vytor Calixto <vytorcalixto@gmail.com>
Date: Mon, 25 Jun 2018 10:20:09 -0300
Subject: [PATCH] Add new filter to school route

Add school building filter
Related: simcaq/SCRUM#430
---
 src/libs/routes/school.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/libs/routes/school.js b/src/libs/routes/school.js
index be935636..33b5e1cf 100644
--- a/src/libs/routes/school.js
+++ b/src/libs/routes/school.js
@@ -452,6 +452,16 @@ rqfCount.addField({
         type: 'integer',
         field: 'ano_censo'
     }
+}).addValue({
+    name: 'school_building',
+    table: 'escola',
+    tableField: 'local_func_predio_escolar',
+    resultField: 'school_building',
+    where: {
+        relation: '=',
+        type: 'boolean',
+        field: 'local_func_predio_escolar'
+    }
 });
 schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
     if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) {
-- 
GitLab