feat: Add cron job for audit logs cleanup

- Add cleanupAuditLogs.js with daily cleanup job
- Delete audit logs older than 7 days
- Runs every day at midnight (00:00)
- Export cleanupOldAuditLogs for manual triggers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-17 07:42:48 +01:00
parent 0585e51b25
commit f8d8bb2330
2 changed files with 62 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { logger } from '../utils/logger.js';
import { startCalendarNotificationCron, triggerEventNotifications, triggerSingleEventNotification } from './calendar/index.js';
import { startAuditCleanupCron, cleanupOldAuditLogs } from './cleanupAuditLogs.js';
/**
* Start all cron jobs
@@ -10,8 +11,11 @@ export const startAllCronJobs = () => {
// Calendar event notifications
startCalendarNotificationCron();
// Audit logs cleanup (daily at midnight)
startAuditCleanupCron();
logger.info('=== Všetky cron jobs inicializované ===');
};
// Export individual functions for testing/manual triggers
export { triggerEventNotifications, triggerSingleEventNotification };
export { triggerEventNotifications, triggerSingleEventNotification, cleanupOldAuditLogs };