Add daily cleanup of old notifications in EventsWorker: Implement a new method to delete notifications older than 30 days, enhancing database management and reducing clutter. Update run loop to trigger this cleanup daily, ensuring timely maintenance of notification records.

This commit is contained in:
Torsten Schulz (local)
2026-01-15 13:45:31 +01:00
parent fc1b0c2259
commit 0083d7be23
2 changed files with 33 additions and 3 deletions

View File

@@ -71,6 +71,12 @@ pub const QUERY_INSERT_NOTIFICATION_FULL: &str = r#"
) VALUES ($1, $2, $3, FALSE, NOW(), NOW());
"#;
/// Löscht alte Notifications (älter als 30 Tage)
pub const QUERY_DELETE_OLD_NOTIFICATIONS: &str = r#"
DELETE FROM falukant_log.notification
WHERE created_at < NOW() - INTERVAL '30 days';
"#;
// Product pricing
pub const QUERY_GET_PRODUCT_COST: &str = r#"
SELECT sell_cost, sell_cost AS original_sell_cost FROM falukant_type.product WHERE id = $1;