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

Change min and max year behaviour

parent e9762475
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -15,13 +15,11 @@ const response = require(`${libs}/middlewares/response`); ...@@ -15,13 +15,11 @@ const response = require(`${libs}/middlewares/response`);
// **Temporary** solution to add where clauses that are common to all requests // **Temporary** solution to add where clauses that are common to all requests
function filter(req, q) { function filter(req, q) {
if (typeof req.min_year !== 'undefined') { if (typeof req.min_year !== 'undefined') {
if (typeof req.max_year === 'undefined') q.where('ano_censo=?', req.min_year); q.where('ano_censo>=?', req.min_year);
else q.where('ano_censo>=?', req.min_year);
} }
if (typeof req.max_year !== 'undefined') { if (typeof req.max_year !== 'undefined') {
if (typeof req.min_year === 'undefined') q.where('ano_censo=?', req.max_year); q.where('ano_censo<=?', req.max_year);
else q.where('ano_censo<=?', req.max_year);
} }
if (typeof req.adm_dependency_id !== 'undefined') { if (typeof req.adm_dependency_id !== 'undefined') {
......
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