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

Send error in /schools when trying to get all

parent b8f91dd4
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
...@@ -62,6 +62,14 @@ rqf.addField({ ...@@ -62,6 +62,14 @@ rqf.addField({
}); });
schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
console.log(req.filter);
if(typeof req.filter === 'undefined' || Object.keys(req.filter).length === 0) {
res.status(400);
next({
status: 400,
message: 'Wrong/No filter specified'
});
}
req.sql.from('escola') req.sql.from('escola')
.field('escola.cod_entidade') .field('escola.cod_entidade')
.field('escola.ano_censo', 'year') .field('escola.ano_censo', 'year')
...@@ -70,4 +78,4 @@ schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -70,4 +78,4 @@ schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next(); next();
}, query, response('school')); }, query, response('school'));
module.exports = schoolApp; module.exports = schoolApp;
\ 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