Skip to content
Snippets Groups Projects
Commit 7302b6d2 authored by Victor Picussa's avatar Victor Picussa
Browse files

Merge branch 'dailyChargeAmount' into development

parents 2c2dbdd6 c99d1d05
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -102,7 +102,7 @@ api.use('/distribution_factor', distributionFactor);
api.use('/siope', siope);
api.use('/out_of_school', outOfSchool);
api.use('/classroom_count', classroomCount);
api.use('/dailyChargeAmount', dailyChargeAmount);
api.use('/daily_charge_amount', dailyChargeAmount);
api.use('/transport', transport);
module.exports = api;
const express = require('express');
const dailyChargeAmount = express.Router();
const dailyChargeAmountApp = express.Router();
const libs = `${process.cwd()}/libs`;
......@@ -31,27 +31,27 @@ const cache = require('apicache').options({ debug: config.debug, statusCodes: {i
let rqf = new ReqQueryFields();
let rqfCount = new ReqQueryFields();
dailyChargeAmount.get('/year_range', (req, res, next) => {
dailyChargeAmountApp.get('/year_range', (req, res, next) => {
req.sql.from('turma')
.field('MIN(turma.ano_censo)', 'start_year')
.field('MAX(turma.ano_censo)', 'end_year');
next();
}, query, response('range'));
dailyChargeAmount.get('/years', (req, res, next) => {
dailyChargeAmountApp.get('/years', (req, res, next) => {
req.sql.from('turma')
.field('DISTINCT turma.ano_censo', 'year');
next();
}, query, response('years'));
dailyChargeAmount.get('/source', (req, res, next) => {
dailyChargeAmountApp.get('/source', (req, res, next) => {
req.sql.from('fonte')
.field('fonte', 'source')
.where('tabela = \'turma\'');
next();
}, query, response('source'));
dailyChargeAmount.get('/adm_dependency', (req, res, next) => {
dailyChargeAmountApp.get('/adm_dependency', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 4; ++i) {
req.result.push({
......@@ -62,7 +62,7 @@ dailyChargeAmount.get('/adm_dependency', (req, res, next) => {
next();
}, response('adm_dependency'));
dailyChargeAmount.get('/adm_dependency_detailed', cache('15 day'), (req, res, next) => {
dailyChargeAmountApp.get('/adm_dependency_detailed', cache('15 day'), (req, res, next) => {
req.result = [];
for(let i = 1; i <= 6; ++i) {
req.result.push({
......@@ -73,7 +73,7 @@ dailyChargeAmount.get('/adm_dependency_detailed', cache('15 day'), (req, res, ne
next();
}, response('adm_dependency_detailed'));
dailyChargeAmount.get('/location', cache('15 day'), (req, res, next) => {
dailyChargeAmountApp.get('/location', cache('15 day'), (req, res, next) => {
req.result = [
{id: 1, name: 'Urbana'},
{id: 2, name: 'Rural'}
......@@ -81,7 +81,7 @@ dailyChargeAmount.get('/location', cache('15 day'), (req, res, next) => {
next();
}, response('location'));
dailyChargeAmount.get('/rural_location', (req, res, next) => {
dailyChargeAmountApp.get('/rural_location', (req, res, next) => {
req.result = [
{id: 1, name: "Urbana"},
{id: 2, name: "Rural"},
......@@ -93,7 +93,7 @@ dailyChargeAmount.get('/rural_location', (req, res, next) => {
next();
}, response('rural_location'));
dailyChargeAmount.get('/education_level_short', (req, res, next) => {
dailyChargeAmountApp.get('/education_level_short', (req, res, next) => {
req.result = [
{id: null, name: 'Não classificada'},
{id: 1, name: 'Creche'},
......@@ -107,7 +107,7 @@ dailyChargeAmount.get('/education_level_short', (req, res, next) => {
next();
}, response('education_level_short'));
dailyChargeAmount.get('/average/education_level_mod', (req, res, next) => {
dailyChargeAmountApp.get('/average/education_level_mod', (req, res, next) => {
req.result = [
{id: null, name: 'Não classificada'},
{id: 1, name: 'Creche'},
......@@ -266,7 +266,7 @@ rqf.addField({
}
});
dailyChargeAmount.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
dailyChargeAmountApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
var status = 0;
if ('integral_time' in req.filter) {
if (req.filter['integral_time'] == '0'
......@@ -325,7 +325,7 @@ dailyChargeAmount.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next();
}, id2str.transform(), response('turma'));
dailyChargeAmount.get('/average', rqf.parse(), rqf.build(), (req, res, next) => {
dailyChargeAmountApp.get('/average', rqf.parse(), rqf.build(), (req, res, next) => {
var status = 0;
if (('education_level_mod' in req.filter || 'education_level_mod' in req.dims)
&& ('integral_time' in req.filter)) {
......@@ -381,4 +381,4 @@ dailyChargeAmount.get('/average', rqf.parse(), rqf.build(), (req, res, next) =>
next();
}, id2str.transform(), response('turma'));
module.exports = dailyChargeAmount;
module.exports = dailyChargeAmountApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment