From 79cae217e8fe33ef3dbfae95047c22f167bff5e1 Mon Sep 17 00:00:00 2001
From: Lucas Gabriel Lima <lgl15@inf.ufpr.br>
Date: Tue, 27 Jun 2017 11:41:48 -0300
Subject: [PATCH] start pib per capita route

---
 src/libs/routes/pibpercapita.js | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 src/libs/routes/pibpercapita.js

diff --git a/src/libs/routes/pibpercapita.js b/src/libs/routes/pibpercapita.js
new file mode 100644
index 00000000..7e4cc548
--- /dev/null
+++ b/src/libs/routes/pibpercapita.js
@@ -0,0 +1,39 @@
+const express = require('express');
+
+const pibpercapitaApp = express.Router();
+
+const libs = `${process.cwd()}/libs`;
+
+const log = require(`${libs}/log`)(module);
+
+const squel = require('squel');
+
+const query = require(`${libs}/middlewares/query`);
+
+const response = require(`${libs}/middlewares/response`);
+
+const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
+
+const id2str = require(`${libs}/middlewares/id2str`);
+
+let rqf = new ReqQueryFields();
+
+idhmrApp.get('/year_range', (req, res, next) => {
+    req.sql.from('ibge_pib')
+    .field('MIN(ibge_pib.ano_censo)', 'start_year')
+    .field('MAX(ibge_pib.ano_censo)', 'end_year');
+    next();
+}, query, response('range'));
+
+rqf.addField({
+    name: 'filter',
+    field: false,
+    where: true
+}).addField({
+    name: 'dims',
+    field: true,
+    where: false
+})
+
+
+module.exports = pibpercapitaApp;
-- 
GitLab