From 3204bb8a4b9de20b0ad80c6085ef7a25da388924 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Mon, 21 Oct 2024 02:25:40 +0300 Subject: [PATCH] update /merge endpoint to use linkGroupName input --- server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index ec76bdf..7511f01 100644 --- a/server.js +++ b/server.js @@ -26,11 +26,11 @@ app.get('/', (req, res) => { }); app.post('/merge', async (req, res) => { - const { calendars } = req.body; + const { linkGroupName, calendars } = req.body; try { - //validate the input - if (!calendars || !Array.isArray(calendars)) { + // Validate the input + if (!linkGroupName || !calendars || !Array.isArray(calendars)) { return res.status(400).json({ error: 'Invalid input' }); } // Generate a unique identifier for this set of calendars @@ -97,7 +97,7 @@ END:VEVENT fs.writeFileSync(`${MERGED_CALENDARS_DIR}/${filename}`, icalString); // Save the user input and generated ID in calendars.json file - saveCalendarData(calendarId, calendars); + saveCalendarData(calendarId, linkGroupName, calendars); res.json({ url: `${req.protocol}://${req.get('host')}/calendar/${calendarId}` }); } catch (error) {