import { scheduleEOIReminders } from '~/server/tasks/eoi-reminders'; import { scheduleEmailProcessing } from '~/server/tasks/process-sales-emails'; export default defineNitroPlugin((nitroApp) => { console.log('[Plugin] Initializing automated tasks...'); // Schedule EOI reminders when server starts console.log('[Plugin] Initializing EOI reminder scheduler...'); // Add a small delay to ensure all services are ready setTimeout(async () => { try { await scheduleEOIReminders(); } catch (error) { console.error('[Plugin] Failed to schedule EOI reminders:', error); } }, 5000); // Schedule email processing for EOI attachments console.log('[Plugin] Initializing email processing scheduler...'); setTimeout(async () => { try { await scheduleEmailProcessing(); } catch (error) { console.error('[Plugin] Failed to schedule email processing:', error); } }, 7000); });