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

Add search to city route

Related: simcaq/SCRUM#210
parent 74cdb823
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!31Issue/210: Rota para pesquisa de localidade
Pipeline #
...@@ -43,7 +43,20 @@ rqf.addField({ ...@@ -43,7 +43,20 @@ rqf.addField({
foreign: 'fk_estado_id', foreign: 'fk_estado_id',
foreignTable: 'municipio' foreignTable: 'municipio'
} }
}); }).addField({
name: 'search',
field: false,
where: true
}).addValueToField({
name: 'name',
table: 'municipio',
tableField: 'nome',
where: {
relation: 'LIKE',
type: 'string',
field: 'nome'
}
}, 'search');;
// Return all cities // Return all cities
cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...@@ -51,4 +64,4 @@ cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -51,4 +64,4 @@ cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next(); next();
}, query, response('city')); }, query, response('city'));
module.exports = cityApp; module.exports = cityApp;
\ No newline at end of file
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