diff --git a/back/methods/chat/notifyIssues.js b/back/methods/chat/notifyIssues.js index b0a42b7be..902ee59cd 100644 --- a/back/methods/chat/notifyIssues.js +++ b/back/methods/chat/notifyIssues.js @@ -8,7 +8,7 @@ module.exports = Self => { }, http: { path: `/notifyIssues`, - verb: 'GET' + verb: 'POST' } }); diff --git a/back/methods/chat/sendQueued.js b/back/methods/chat/sendQueued.js index ab94a1746..66fbfcdc5 100644 --- a/back/methods/chat/sendQueued.js +++ b/back/methods/chat/sendQueued.js @@ -10,7 +10,7 @@ module.exports = Self => { }, http: { path: `/sendQueued`, - verb: 'GET' + verb: 'POST' } }); diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index 7cfb9f8d1..9da508285 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -12,7 +12,7 @@ module.exports = Self => { }, http: { path: `/deleteTrashFiles`, - verb: 'GET' + verb: 'POST' } }); diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 86a9e1f31..c5705513f 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -12,7 +12,7 @@ module.exports = Self => { }, http: { path: `/updateData`, - verb: 'GET' + verb: 'POST' } }); diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index ec8244f49..05b223598 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -12,7 +12,7 @@ module.exports = Self => { }, http: { path: `/downloadImages`, - verb: 'GET' + verb: 'POST' } }); diff --git a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js index bfecb1605..3e64a985a 100644 --- a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js +++ b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js @@ -11,7 +11,7 @@ module.exports = Self => { }, http: { path: `/checkInbox`, - verb: 'GET' + verb: 'POST' } }); @@ -58,8 +58,8 @@ module.exports = Self => { emailBody = bufferCopy.toUpperCase().trim(); const bodyPositionOK = emailBody.match(/\bOK\b/i); - - if (bodyPositionOK != null && (bodyPositionOK.index == 0 || bodyPositionOK.index == 122)) + const bodyPositionIndex = (bodyPositionOK.index == 0 || bodyPositionOK.index == 122); + if (bodyPositionOK != null && bodyPositionIndex) isEmailOk = true; else isEmailOk = false; diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html index 46ba87dea..9b79f3317 100644 --- a/modules/zone/front/events/index.html +++ b/modules/zone/front/events/index.html @@ -91,7 +91,7 @@ = todayMinDate && toDate <= todayMaxDate) + throw new Error('You cannot close tickets for today'); const tickets = await db.rawSql(` SELECT @@ -36,7 +45,7 @@ module.exports = async function(request, response, next) { AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND t.refFk IS NULL - GROUP BY t.id`, [reqArgs.to, reqArgs.to]); + GROUP BY t.id`, [toDate, toDate]); await closure.start(tickets, response.locals); @@ -52,7 +61,11 @@ module.exports = async function(request, response, next) { AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') AND t.routeFk - AND z.name LIKE '%MADRID%'`, [reqArgs.to, reqArgs.to]); + AND z.name LIKE '%MADRID%'`, [toDate, toDate]); + + response.status(200).json({ + message: 'Success' + }); } catch (error) { next(error); } diff --git a/print/methods/closure/closeByAgency.js b/print/methods/closure/closeByAgency.js index 12e6b4c53..bbf72f137 100644 --- a/print/methods/closure/closeByAgency.js +++ b/print/methods/closure/closeByAgency.js @@ -3,7 +3,7 @@ const closure = require('./closure'); module.exports = async function(request, response, next) { try { - const reqArgs = request.query; + const reqArgs = request.body; if (!reqArgs.agencyModeId) throw new Error('The argument agencyModeId is required'); @@ -14,10 +14,6 @@ module.exports = async function(request, response, next) { if (!reqArgs.to) throw new Error('The argument to is required'); - response.status(200).json({ - message: 'Success' - }); - const agencyIds = reqArgs.agencyModeId.split(','); const tickets = await db.rawSql(` SELECT @@ -53,6 +49,10 @@ module.exports = async function(request, response, next) { ]); await closure.start(tickets, response.locals); + + response.status(200).json({ + message: 'Success' + }); } catch (error) { next(error); } diff --git a/print/methods/closure/closeByRoute.js b/print/methods/closure/closeByRoute.js index 32a1688d3..1f5d571f6 100644 --- a/print/methods/closure/closeByRoute.js +++ b/print/methods/closure/closeByRoute.js @@ -4,15 +4,11 @@ const closure = require('./closure'); module.exports = async function(request, response, next) { try { - const reqArgs = request.query; + const reqArgs = request.body; if (!reqArgs.routeId) throw new Error('The argument routeId is required'); - response.status(200).json({ - message: 'Success' - }); - const tickets = await db.rawSql(` SELECT t.id, @@ -56,6 +52,10 @@ module.exports = async function(request, response, next) { const email = new Email('driver-route', args); await email.send(); } + + response.status(200).json({ + message: 'Success' + }); } catch (error) { next(error); } diff --git a/print/methods/closure/closeByTicket.js b/print/methods/closure/closeByTicket.js index f6d97cba3..71cadcecf 100644 --- a/print/methods/closure/closeByTicket.js +++ b/print/methods/closure/closeByTicket.js @@ -3,15 +3,11 @@ const closure = require('./closure'); module.exports = async function(request, response, next) { try { - const reqArgs = request.query; + const reqArgs = request.body; if (!reqArgs.ticketId) throw new Error('The argument ticketId is required'); - response.status(200).json({ - message: 'Success' - }); - const tickets = await db.rawSql(` SELECT t.id, @@ -38,6 +34,10 @@ module.exports = async function(request, response, next) { GROUP BY e.ticketFk`, [reqArgs.ticketId]); await closure.start(tickets, response.locals); + + response.status(200).json({ + message: 'Success' + }); } catch (error) { next(error); } diff --git a/print/methods/closure/index.js b/print/methods/closure/index.js index fcca76f71..2d5eaf4c5 100644 --- a/print/methods/closure/index.js +++ b/print/methods/closure/index.js @@ -1,9 +1,9 @@ const express = require('express'); const router = new express.Router(); -router.get('/all', require('./closeAll')); -router.get('/by-ticket', require('./closeByTicket')); -router.get('/by-agency', require('./closeByAgency')); -router.get('/by-route', require('./closeByRoute')); +router.post('/all', require('./closeAll')); +router.post('/by-ticket', require('./closeByTicket')); +router.post('/by-agency', require('./closeByAgency')); +router.post('/by-route', require('./closeByRoute')); module.exports = router;