summaryrefslogtreecommitdiff
path: root/src/helpers.ts
diff options
context:
space:
mode:
authorRaphael <mail@raphaelkabo.com>2023-10-06 16:54:03 +0100
committerGitHub <noreply@github.com>2023-10-06 16:54:03 +0100
commita14afed944e5f0b87af96cc5c6a262d246b88d1d (patch)
tree26104aa7f2717ea7e8f69734a2181d456f264481 /src/helpers.ts
parentf390b1d45b3f44a860fef4df2b31064f441b5065 (diff)
parent722d54e5ae8957436818b14e7aea613b19b12d28 (diff)
Merge pull request #111 from lowercasename/rk/typescript
Typescript migration
Diffstat (limited to 'src/helpers.ts')
-rw-r--r--src/helpers.ts64
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;
}