1
0
Fork 0

refactor: encapsulate calendar file saving with saveCalendarFile helper

This commit is contained in:
Ryan Mwangi 2024-11-07 14:25:02 +03:00
parent 1bc7119b08
commit 00f5fedb2a
1 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,13 @@ const mergeCalendarEvents = (calendarInstance, results) => {
});
};
// Save calendar data to file
const saveCalendarFile = (filename, content) => {
const filePath = path.join(MERGED_CALENDARS_DIR, filename);
fs.writeFileSync(filePath, content);
return filePath;
};
// Merge calendars endpoint
app.post('/merge', async (req, res) => {
const { linkGroupName, calendars } = req.body;