diff --git a/CHANGELOG.md b/CHANGELOG.md index d992a6977619bfa7f78e8d96b92ac8ebad79b86d..4253be3bcea7fffcbfdb146ffaeb6380362f0ecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.2.1 - 2018-05-22 +### Changed +- Add state id in infrastructure + ## 1.2.0 - 2018-05-21 ### Added - Classroom count route diff --git a/src/libs/routes/infrastructure.js b/src/libs/routes/infrastructure.js index e201e1f41f4156926c04fa76fa78895409507b36..290bf1a0c393db0545c3e4d88dfc736dc6be5b0d 100644 --- a/src/libs/routes/infrastructure.js +++ b/src/libs/routes/infrastructure.js @@ -108,8 +108,8 @@ rqf.addField({ }, 'dims').addValueToField({ name: 'city', table: 'municipio', - tableField: 'nome', - resultField: 'city_name', + tableField: 'id', + resultField: 'city_id', where: { relation: '=', type: 'integer', @@ -121,11 +121,11 @@ rqf.addField({ foreign: 'municipio_id', foreignTable: 'escola' } -}, 'filter').addValue({ +}, 'filter').addValueToField({ name: 'state', table: 'estado', - tableField: 'nome', - resultField: 'state_name', + tableField: ['nome', 'id'], + resultField: ['state_name', 'state_id'], where: { relation: '=', type: 'integer', @@ -137,7 +137,23 @@ rqf.addField({ foreign: 'estado_id', foreignTable: 'escola' } -}).addValue({ +}, 'dims').addValueToField({ + name: 'state', + table: 'estado', + tableField: 'id', + resultField: 'state_id', + where: { + relation: '=', + type: 'integer', + field: 'estado_id', + table: 'escola' + }, + join: { + primary: 'id', + foreign: 'estado_id', + foreignTable: 'escola' + } +}, 'filter').addValue({ name: 'region', table: 'regiao', tableField: 'nome',