diff --git a/src/libs/routes/city.js b/src/libs/routes/city.js index 41b22a660096e95b58611c7b4edcfe5e758db79d..3214f7f9d6caaafad8deb6b2d8d94b3525a10a6a 100644 --- a/src/libs/routes/city.js +++ b/src/libs/routes/city.js @@ -43,7 +43,20 @@ rqf.addField({ foreign: 'fk_estado_id', 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 cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { @@ -51,4 +64,4 @@ cityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { next(); }, query, response('city')); -module.exports = cityApp; \ No newline at end of file +module.exports = cityApp;