From 3989338f0fc2bd394716b4199192b869b8e9bf3b Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Thu, 8 Feb 2018 18:03:50 +0100 Subject: Add basis schedule support to the backend --- src/server/lib/getURLOfUser.js | 6 +++--- src/server/routes/getSchedule.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/server') diff --git a/src/server/lib/getURLOfUser.js b/src/server/lib/getURLOfUser.js index 82b0180..f44d1a3 100644 --- a/src/server/lib/getURLOfUser.js +++ b/src/server/lib/getURLOfUser.js @@ -1,8 +1,8 @@ const leftPad = require('left-pad'); // I imported this just to piss you off ;) -function getURLOfUser(type, index, week) { - return 'http://www.meetingpointmco.nl/Roosters-AL/doc/dagroosters/' + - `${leftPad(week, 2, '0')}/${type}/${type}${leftPad(index + 1, 5, '0')}.htm`; +function getURLOfUser(scheduleType, type, index, week) { + return `http://www.meetingpointmco.nl/Roosters-AL/doc/${scheduleType}roosters/` + + `${leftPad(week, 2, '0')}/${type}/${type}${leftPad(index + 1, 5, '0')}.htm`; } module.exports = getURLOfUser; diff --git a/src/server/routes/getSchedule.js b/src/server/routes/getSchedule.js index 5e9bb29..9d965bf 100644 --- a/src/server/routes/getSchedule.js +++ b/src/server/routes/getSchedule.js @@ -41,7 +41,9 @@ router.get('/:type/:value', (req, res, next) => { const { index } = user; - const url = getURLOfUser(type, index, week); + const scheduleType = req.query.type || 'dag'; + + const url = getURLOfUser(scheduleType, type, index, week); request(url, { encoding: null }, (err, data) => { if (err) { -- cgit v1.1