refactor: encapsulate calendar file saving with saveCalendarFile helper
This commit is contained in:
parent
1bc7119b08
commit
00f5fedb2a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue