Files
crm-server/src/cron/index.js
richardtekula 70fa080455 feat: Add user management APIs, status enum, enhanced notifications
- Add updateUser and resetUserPassword admin endpoints
- Change company status from boolean to enum (registered, lead, customer, inactive)
- Add 'important' event type to calendar validators and email templates
- Add 1-hour-before event notifications cron job
- Add 18:00 evening notifications for next-day events
- Add contact description field support
- Fix count() function usage in admin service
- Add SQL migrations for schema changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 09:41:29 +01:00

28 lines
1.1 KiB
JavaScript

import { logger } from '../utils/logger.js';
import { startCalendarNotificationCron, startOneHourBeforeNotificationCron, startEveningNotificationCron, triggerEventNotifications, triggerSingleEventNotification } from './calendar/index.js';
import { startAuditCleanupCron, cleanupOldAuditLogs } from './cleanupAuditLogs.js';
/**
* Start all cron jobs
*/
export const startAllCronJobs = () => {
// Calendar event notifications (morning - configurable time)
const calendarJob = startCalendarNotificationCron();
logger.info(`Cron: ${calendarJob.name}`);
// 1-hour-before notifications (every hour)
const oneHourJob = startOneHourBeforeNotificationCron();
logger.info(`Cron: ${oneHourJob.name}`);
// Evening notifications at 18:00 for tomorrow's events
const eveningJob = startEveningNotificationCron();
logger.info(`Cron: ${eveningJob.name}`);
// Audit logs cleanup
const auditJob = startAuditCleanupCron();
logger.info(`Cron: ${auditJob.name}`);
};
// Export individual functions for testing/manual triggers
export { triggerEventNotifications, triggerSingleEventNotification, cleanupOldAuditLogs };