Skip to content
Snippets Groups Projects
Commit d96df026 authored by Rafael S Castilho's avatar Rafael S Castilho
Browse files

add new table to routes

parent 3703e3e5
Branches
No related tags found
1 merge request!12Development
/*
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of SMPPIR-Node.
SMPPIR-Node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SMPPIR-Node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SMPPIR-Node. If not, see <https://www.gnu.org/licenses/>.
*/
const express = require('express');
const quilombola_metrics = express.Router();
const libs = `${process.cwd()}/libs`;
const squel = require('squel');
const query = require(`${libs}/middlewares/query`).query;
const response = require(`${libs}/middlewares/response`);
const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
const rqf = new ReqQueryFields();
rqf.addField({
name: 'filter',
field: false,
where: true,
}).addField({
name: 'dims',
field: true,
where: false,
})
.addValue({
name: 'year',
table: 'cad_unico_quilombola_metrics_ag',
tableField: 'ano_censo',
resultField: 'ano_pesquisa',
where: {
relation: '=',
type: 'integer',
field: 'ano_censo',
},
})
;
quilombola_metrics.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.sql.toString());
req.sql.field('*')
.from('cad_unico_quilombola_metrics_ag');
next();
}, query, response('cad_unico'));
module.exports = quilombola_metrics;
......@@ -163,6 +163,8 @@ const african_culture = require(`${libs}/routes/SMPPIR/african_culture`)
const african_sustentability = require(`${libs}/routes/SMPPIR/african_sustentability`)
const quilombola_metrics = require(`${libs}/routes/SMPPIR/quilombola_metrics`)
//const eixo_2_count = require(`${libs}/routes/SMPPIR/eixo_2_count`)
......@@ -242,7 +244,7 @@ api.use('/eixo_4', eixo_4);
api.use('/african_rights', african_rights);
api.use('/african_culture', african_culture);
api.use('/african_sustentability', african_sustentability);
api.use(`/quilombola_metrics`,quilombola_metrics)
//api.use('/eixo_2_count', eixo_2_count)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment