feat: add email worker handlers for inquiry confirmation and sales notification
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,42 @@ export const emailWorker = new Worker(
|
||||
await syncInbox(accountId);
|
||||
break;
|
||||
}
|
||||
case 'send-inquiry-confirmation': {
|
||||
const { to, firstName, mooringNumber, contactEmail } = job.data as {
|
||||
to: string;
|
||||
firstName: string;
|
||||
mooringNumber: string | null;
|
||||
contactEmail: string;
|
||||
};
|
||||
const { inquiryClientConfirmation } =
|
||||
await import('@/lib/email/templates/inquiry-client-confirmation');
|
||||
const { sendEmail } = await import('@/lib/email/index');
|
||||
const email = inquiryClientConfirmation({ firstName, mooringNumber, contactEmail });
|
||||
await sendEmail(to, email.subject, email.html, undefined, email.text);
|
||||
break;
|
||||
}
|
||||
case 'send-inquiry-sales-notification': {
|
||||
const { to, fullName, email, phone, mooringNumber, crmUrl } = job.data as {
|
||||
to: string;
|
||||
fullName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
mooringNumber: string | null;
|
||||
crmUrl: string;
|
||||
};
|
||||
const { inquirySalesNotification } =
|
||||
await import('@/lib/email/templates/inquiry-sales-notification');
|
||||
const { sendEmail } = await import('@/lib/email/index');
|
||||
const notification = inquirySalesNotification({
|
||||
fullName,
|
||||
email,
|
||||
phone,
|
||||
mooringNumber,
|
||||
crmUrl,
|
||||
});
|
||||
await sendEmail(to, notification.subject, notification.html, undefined, notification.text);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
logger.warn({ jobName: job.name }, 'Unknown email job');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user