fix: don't remind platform users in reminder cron (#20056)

This commit is contained in:
Morgan
2025-03-17 23:00:25 +02:00
committed by GitHub
parent 3a181f1dac
commit dd45d8cdbc
+10 -1
View File
@@ -55,6 +55,8 @@ async function postHandler(request: NextRequest) {
locale: true,
timeZone: true,
destinationCalendar: true,
isPlatformManaged: true,
platformOAuthClients: { select: { id: true, areEmailsEnabled: true } },
},
},
eventType: {
@@ -70,11 +72,18 @@ async function postHandler(request: NextRequest) {
},
});
const bookingsToRemind = bookings.filter(
(booking) =>
!booking.user ||
!booking.user.isPlatformManaged ||
(booking.user.isPlatformManaged && Boolean(booking.user.platformOAuthClients?.[0]?.areEmailsEnabled))
);
const reminders = await prisma.reminderMail.findMany({
where: {
reminderType: ReminderType.PENDING_BOOKING_CONFIRMATION,
referenceId: {
in: bookings.map((b) => b.id),
in: bookingsToRemind.map((b) => b.id),
},
elapsedMinutes: {
gte: interval,