feat: add feature flag for sending workflow emails with smtp (#21187)

* add feature flag

* add unit tests

---------

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2025-05-08 22:39:14 +00:00
1 parent 50173658f8
commit 80fa172f79
12 files changed
+165 -7

No files matched your search

@@ -40,7 +40,7 @@ export async function handler(req: NextRequest) {
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
}
const isSendgridEnabled = process.env.SENDGRID_API_KEY && process.env.SENDGRID_EMAIL;
const isSendgridEnabled = !!(process.env.SENDGRID_API_KEY && process.env.SENDGRID_EMAIL);
if (isSendgridEnabled) {
const remindersToDelete: { referenceId: string | null; id: number }[] = await getAllRemindersToDelete();
@@ -65,9 +65,7 @@ export async function handler(req: NextRequest) {
});
await Promise.allSettled(handlePastCancelledReminders);
}
if (isSendgridEnabled) {
//cancel reminders for cancelled/rescheduled bookings that are scheduled within the next hour
const remindersToCancel: { referenceId: string | null; id: number }[] = await getAllRemindersToCancel();