import cron from 'node-cron'; import { createCorrelationId, runWithCorrelationId } from '../lib/correlation.js'; export function scheduleJobs({ runPendingApprovals, cleanupOldLogs, log }) { cron.schedule('0 30 9 * * *', async function () { const correlationId = createCorrelationId({ routeName: 'cron' }); await runWithCorrelationId(correlationId, async () => { try { log.logger('cron', 'Starting scheduled job'); await runPendingApprovals(); await cleanupOldLogs(); log.logger('cron', 'Scheduled job completed'); } catch (error) { log.logError('cron', 'Scheduled job failed', error); } }); }); }