diff --git a/lib/services/sync-scheduler.ts b/lib/services/sync-scheduler.ts index b907094..516a6f4 100644 --- a/lib/services/sync-scheduler.ts +++ b/lib/services/sync-scheduler.ts @@ -22,7 +22,7 @@ export interface ScheduleConfig { name: string; description: string; cron_expression: string; - sync_type: 'incremental' | 'full' | 'veeam-incremental' | 'veeam-full' | 'veeam-rpo-check' | 'contract-services' | 'engagement-daily' | 'zoom-daily' | 'morning-summary' | 'ticket-digest-daily' | 'ticket-digest-weekly' | 'ticket-digest-monthly' | 'device-link-reconcile' | 'integration-health' | 'qbo' | 'mimecast-sync' | 'appgate-sessions' | 'appgate-daily' | 'tickets-reconcile' | 'pax8-daily' | 'phishing-sweep'; + sync_type: 'incremental' | 'full' | 'veeam-incremental' | 'veeam-full' | 'veeam-rpo-check' | 'contract-services' | 'engagement-daily' | 'zoom-daily' | 'morning-summary' | 'ticket-digest-daily' | 'ticket-digest-weekly' | 'ticket-digest-monthly' | 'device-link-reconcile' | 'integration-health' | 'qbo' | 'mimecast-sync' | 'appgate-sessions' | 'appgate-daily' | 'tickets-reconcile' | 'pax8-daily' | 'phishing-sweep' | 'route53-incremental' | 'route53-full'; years_back?: number; is_enabled: boolean; last_run?: Date; @@ -307,6 +307,22 @@ class SyncScheduler { sync_type: 'phishing-sweep', is_enabled: false, }, + { + id: 'route53-incremental', + name: 'Route 53 Incremental Sync', + description: 'Syncs AWS Route 53 hosted zones and records every 15 minutes', + cron_expression: '*/15 * * * *', + sync_type: 'route53-incremental', + is_enabled: false, + }, + { + id: 'route53-full', + name: 'Route 53 Full Sync', + description: 'Full AWS Route 53 zone and record reconciliation daily at 1:00 AM', + cron_expression: '0 1 * * *', + sync_type: 'route53-full', + is_enabled: false, + }, ]; for (const schedule of defaultSchedules) { @@ -491,6 +507,27 @@ class SyncScheduler { await getPax8SyncService().fullSync('scheduled'); } } + } else if (config.sync_type === 'route53-incremental') { + // D-10: unlike pax8-daily above, Route 53 dispatch deliberately does + // NOT consult the admin disable toggle — disabling Route 53 in + // /admin/integrations only suppresses health display, it never stops + // sync. PAX8 remains the sole integration where that toggle also + // gates scheduled execution. + const { isRoute53Configured } = await import('@/lib/services/route53-factory'); + if (!isRoute53Configured()) { + console.log('[SCHEDULER] Skipping route53-incremental — Route 53 not configured'); + } else { + const { getRoute53SyncService } = await import('@/lib/services/route53-sync-service'); + await getRoute53SyncService().incrementalSync('scheduled'); + } + } else if (config.sync_type === 'route53-full') { + const { isRoute53Configured } = await import('@/lib/services/route53-factory'); + if (!isRoute53Configured()) { + console.log('[SCHEDULER] Skipping route53-full — Route 53 not configured'); + } else { + const { getRoute53SyncService } = await import('@/lib/services/route53-sync-service'); + await getRoute53SyncService().fullSync('scheduled'); + } } else if (config.sync_type === 'mimecast-sync') { const { isMimecastConfigured } = await import('@/lib/services/mimecast-client'); if (!isMimecastConfigured()) {