From 6c8e9792f4b778a338bf1cce4b1ab5c04d7576eb Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Wed, 13 Sep 2017 11:05:58 -0300 Subject: [PATCH] Revert "Generating header for download" This reverts commit 65129880a958006ec0d860374c62ff78df3f05a5. --- src/libs/routes/school.js | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/libs/routes/school.js b/src/libs/routes/school.js index 3ac701b0..0d6ab559 100644 --- a/src/libs/routes/school.js +++ b/src/libs/routes/school.js @@ -469,34 +469,18 @@ schoolApp.get('/count', cache('15 day'), rqfCount.parse(), rqfCount.build(), (re next(); }, query, id2str.transform(), response('school')); -schoolApp.get('/count/download', (req, res, next) => { - // first, query the mapping - req.sql.from('mapping_escola') - .field('target_name') - .field('name'); - next(); -}, query, (req, res, next) => { - req.resetSql(); - next(); -}, rqfCount.parse(), rqfCount.build(), (req, res, next) => { +schoolApp.get('/count/download', rqfCount.parse(), rqfCount.build(), (req, res, next) => { let username = req.query.user; let email = req.query.email; - req.sql.from('escola'); - let header = ''; - req.result.forEach((result) => { - req.sql.field(result.name, result.target_name); - if(header === '') header += result.target_name; - else header = header + ';' + result.target_name; - }); - + req.sql.from('escola') + .field('*'); let form = { query: req.sql.toString(), table: req.sql.tableFrom, name: req.sql.tableFrom, username, - email, - header + email }; request.post(config.cdn.url + '/api/v1/file', {form}, (err, response, body) => { if(err) { -- GitLab