diff options
Diffstat (limited to 'src/helpers.ts')
-rw-r--r-- | src/helpers.ts | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/helpers.ts b/src/helpers.ts index 4528042..72bbd17 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -10,41 +10,41 @@ const siteName = config.general.site_name; // LOGGING export function addToLog(process: string, status: string, message: string) { - const logEntry = { - status, - process, - message, - timestamp: new Date(), - }; - new Log(logEntry).save().catch(() => { - console.log("Error saving log entry!"); - }); + const logEntry = { + status, + process, + message, + timestamp: new Date(), + }; + new Log(logEntry).save().catch(() => { + console.log("Error saving log entry!"); + }); } export function exportIcal(events: IEvent[], calendarName: string) { - if (!events || events.length < 1) return; + if (!events || events.length < 1) return; - // Create a new icalGenerator... generator - const cal = icalGenerator({ - name: calendarName || siteName, - }); - events.forEach((event) => { - // Add the event to the generator - cal.createEvent({ - start: moment.tz(event.start, event.timezone), - end: moment.tz(event.end, event.timezone), - timezone: event.timezone, - summary: event.name, - description: event.description, - organizer: { - name: event.hostName || "Anonymous", - email: event.creatorEmail || "anonymous@anonymous.com", - }, - location: event.location, - url: "https://" + domain + "/" + event.id, + // Create a new icalGenerator... generator + const cal = icalGenerator({ + name: calendarName || siteName, + }); + events.forEach((event) => { + // Add the event to the generator + cal.createEvent({ + start: moment.tz(event.start, event.timezone), + end: moment.tz(event.end, event.timezone), + timezone: event.timezone, + summary: event.name, + description: event.description, + organizer: { + name: event.hostName || "Anonymous", + email: event.creatorEmail || "anonymous@anonymous.com", + }, + location: event.location, + url: "https://" + domain + "/" + event.id, + }); }); - }); - // Stringify it! - const string = cal.toString(); - return string; + // Stringify it! + const string = cal.toString(); + return string; } |