From 5a6bc3cc6f808c5e80184a5d5ef71ea5c9bf500c Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 16 Jul 2019 11:22:40 +0200 Subject: [PATCH] add route and controller for invoice integration --- controllers/integration.js | 13 +++++++++++++ routes/index.js | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/controllers/integration.js b/controllers/integration.js index 235a774..b9ad18e 100644 --- a/controllers/integration.js +++ b/controllers/integration.js @@ -65,9 +65,22 @@ const getMemberIncidents = (req, res) => { }); }; +const addFees = (req, res) => { + const memberIds = req.body && req.body.memberIds ? req.body.memberIds : null; + const fromDate = req.body && req.body.fromDate ? req.body.fromDate : null; + const toDate = req.body && req.body.toDate ? req.body.toDate : null; + + if (fromDate && toDate){ + send(); + }else{ + res.status(400).send('Member ID missing'); + } +}; + module.exports = { getKnownOfficeResourceMappings, addNewMapping, getAllIncidentsController, getMemberIncidents, + addFees, }; diff --git a/routes/index.js b/routes/index.js index 0a6f01a..11efed8 100644 --- a/routes/index.js +++ b/routes/index.js @@ -2,8 +2,14 @@ const { apiStatusCheck } = require('../controllers/apiStatusCheck'); const { uploadDoorLockData } = require('../controllers/doorLock'); -const { getKnownOfficeResourceMappings, addNewMapping, getAllIncidentsController, getMemberIncidents } = require('../controllers/integration'); const { fetchMembersList } = require('../controllers/officeRnD'); +const { + getKnownOfficeResourceMappings, + addNewMapping, + getAllIncidentsController, + getMemberIncidents, + addFees +} = require('../controllers/integration'); const { calculateDoorLockCharges } = require('../services/integration/doorLockCharges'); @@ -21,6 +27,8 @@ router.get('/integration/report/allIncidents/:startDate/:endDate', getAllInciden router.get('/officeRnD/membersList', fetchMembersList); +router.post('/integration/addFees', addFees); + // temporary route, manually trigger door lock charge calculations router.get('/calculate', (req, res) => { calculateDoorLockCharges(); res.send();});