From 66172e0baa2459c51374b20f602b1296cabdd04d Mon Sep 17 00:00:00 2001 From: Joshua Ryder Date: Tue, 4 Nov 2025 14:07:14 -0500 Subject: [PATCH] Add sermon retention policy feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented a configurable retention policy system for sermons with automatic cleanup: - Added settings table to store retention policy configuration - Created API endpoints for getting/setting retention policy - Added Database Settings section to admin page with retention options (forever, 1-10 years) - Implemented manual cleanup endpoint for on-demand deletion - Added automated daily cleanup task via Nitro plugin - Sermons are deleted based on their date field according to the retention policy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pages/admin.vue | 128 ++++++++++++++++++- server/api/sermons/cleanup.post.ts | 57 +++++++++ server/api/settings/retention-policy.get.ts | 29 +++++ server/api/settings/retention-policy.post.ts | 42 ++++++ server/plugins/sermon-cleanup.ts | 56 ++++++++ server/utils/database.ts | 45 +++++++ 6 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 server/api/sermons/cleanup.post.ts create mode 100644 server/api/settings/retention-policy.get.ts create mode 100644 server/api/settings/retention-policy.post.ts create mode 100644 server/plugins/sermon-cleanup.ts diff --git a/pages/admin.vue b/pages/admin.vue index 1780d3f..e8c2c18 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -346,8 +346,68 @@ + + +
+

Database Settings

+ +
+
+ +

+ Choose how long to keep sermons in the database. Older sermons will be automatically deleted based on this policy. +

+ +
+ +
+ {{ retentionPolicyError }} +
+
+ {{ retentionPolicySuccess }} +
+ +
+ +

+ Manually trigger the cleanup process to delete sermons according to the retention policy. + This will also run automatically on a daily schedule. +

+
+ +
+ {{ cleanupError }} +
+
+ {{ cleanupSuccess }} +
+
+
- +