summaryrefslogtreecommitdiff
path: root/src/routes.js
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2024-02-25 18:17:27 +0000
committerRaphael <mail@raphaelkabo.com>2024-02-25 21:27:27 +0000
commit1bb89ca09d097c704885c42920efea0f6624dc20 (patch)
tree76eb4af4467e9169e97593b2b991be1bddb1a260 /src/routes.js
parent7ff0bebd9fbdf1c982d7cc42a7057d36a3e2486a (diff)
feat: set number of days to store concluded events (including permanently)
Diffstat (limited to 'src/routes.js')
-rwxr-xr-xsrc/routes.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/routes.js b/src/routes.js
index ab12a3a..8ea7e05 100755
--- a/src/routes.js
+++ b/src/routes.js
@@ -82,7 +82,13 @@ router.use(fileUpload());
// SCHEDULED DELETION
schedule.scheduleJob("59 23 * * *", function (fireDate) {
- const too_old = moment.tz("Etc/UTC").subtract(7, "days").toDate();
+ const deleteAfterDays = config.general.delete_after_days;
+ if (!deleteAfterDays || deleteAfterDays <= 0) {
+ // Deletion is disabled
+ return;
+ }
+
+ const too_old = moment.tz("Etc/UTC").subtract(deleteAfterDays, "days").toDate();
console.log(
"Old event deletion running! Deleting all events concluding before ",
too_old,