From 4310d3f395bc564f2c98eb603d605c144332d288 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 29 Oct 2024 02:29:29 +0300 Subject: [PATCH] create a new iCalendar instance in the calendar/:name end point --- server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 2fbc326..d36870c 100644 --- a/server.js +++ b/server.js @@ -87,7 +87,7 @@ app.post('/merge', async (req, res) => { // Save the calendar to a file fs.writeFileSync(`${MERGED_CALENDARS_DIR}/${filename}`, calendar.toString()); - + // Save the user input and sanitizedLinkGroupName in a separate JSON file saveCalendarData(sanitizedLinkGroupName, linkGroupName, calendars); @@ -138,6 +138,9 @@ app.get('/calendar/:name', async (req, res) => { // Filter out any failed requests const validResults = results.filter((result) => result !== null); + // Create a new iCalendar instance + const calendar = icalGenerator({ name: calendarName }); + // Parse calendar data const mergedCal = []; validResults.forEach((result) => {