Skip to content
Snippets Groups Projects
Commit fbfa487f authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Change city route to new db schema

parent b3b5b1df
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!34Db simcaq dev2
...@@ -21,11 +21,11 @@ rqf.addField({ ...@@ -21,11 +21,11 @@ rqf.addField({
}).addValue({ }).addValue({
name: 'id', name: 'id',
table: 'municipio', table: 'municipio',
tableField: 'pk_cod_ibge', tableField: 'id',
where: { where: {
relation: '=', relation: '=',
type: 'integer', type: 'integer',
field: 'pk_cod_ibge' field: 'id'
} }
}).addValue({ }).addValue({
name: 'state', name: 'state',
...@@ -35,12 +35,12 @@ rqf.addField({ ...@@ -35,12 +35,12 @@ rqf.addField({
where: { where: {
relation: '=', relation: '=',
type: 'integer', type: 'integer',
field: 'fk_estado_id', field: 'estado_id',
table: 'municipio' table: 'municipio'
}, },
join: { join: {
primary: 'pk_estado_id', primary: 'id',
foreign: 'fk_estado_id', foreign: 'estado_id',
foreignTable: 'municipio' foreignTable: 'municipio'
} }
}).addField({ }).addField({
...@@ -62,8 +62,8 @@ rqf.addField({ ...@@ -62,8 +62,8 @@ rqf.addField({
cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.from('municipio') req.sql.from('municipio')
.field('municipio.nome', 'name') .field('municipio.nome', 'name')
.field('municipio.pk_cod_ibge', 'id') .field('municipio.id')
.field('municipio.fk_estado_id', 'state_id'); .field('municipio.estado_id', 'state_id');
next(); next();
}, query, response('city')); }, query, response('city'));
......
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