diff options
author | Raphael Kabo <mail@raphaelkabo.com> | 2023-05-13 19:21:09 +0100 |
---|---|---|
committer | Raphael Kabo <mail@raphaelkabo.com> | 2023-05-13 19:21:09 +0100 |
commit | 365398359f2d80345a61f76f3ecf0fd6eb9bdde6 (patch) | |
tree | a54618c5dc9f84a8ba06f9c8c33d244f5f26f779 /src/helpers.js | |
parent | 45ecdf59f8b0c4090041ce86aad2e5f606253f0d (diff) |
Migrate from CommonJS to ES modules
Diffstat (limited to 'src/helpers.js')
-rw-r--r-- | src/helpers.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/helpers.js b/src/helpers.js index 9b7559f..305187f 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,14 +1,14 @@ -const domain = require("./config/domain.js").domain; -const siteName = require("./config/domain.js").sitename; - -const mongoose = require("mongoose"); -const Log = mongoose.model("Log"); -var moment = require("moment-timezone"); -const icalGenerator = require("ical-generator"); +import moment from "moment-timezone"; +import icalGenerator from "ical-generator"; +import Log from "./models/Log.js"; +import { getConfig } from "./lib/config.js"; +const config = getConfig(); +const domain = config.general.domain; +const siteName = config.general.site_name; // LOGGING -function addToLog(process, status, message) { +export function addToLog(process, status, message) { let logEntry = new Log({ status: status, process: process, @@ -20,7 +20,7 @@ function addToLog(process, status, message) { }); } -function exportIcal(events, calendarName) { +export function exportIcal(events, calendarName) { // Create a new icalGenerator... generator const cal = icalGenerator({ name: calendarName || siteName, @@ -52,8 +52,3 @@ function exportIcal(events, calendarName) { const string = cal.toString(); return string; } - -module.exports = { - addToLog, - exportIcal, -}; |