Skip to content

Commit dd45d8c

Browse files
fix: don't remind platform users in reminder cron (#20056)
1 parent 3a181f1 commit dd45d8c

File tree

1 file changed

+10
-1
lines changed
  • apps/web/app/api/cron/bookingReminder

1 file changed

+10
-1
lines changed

apps/web/app/api/cron/bookingReminder/route.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ async function postHandler(request: NextRequest) {
5555
locale: true,
5656
timeZone: true,
5757
destinationCalendar: true,
58+
isPlatformManaged: true,
59+
platformOAuthClients: { select: { id: true, areEmailsEnabled: true } },
5860
},
5961
},
6062
eventType: {
@@ -70,11 +72,18 @@ async function postHandler(request: NextRequest) {
7072
},
7173
});
7274

75+
const bookingsToRemind = bookings.filter(
76+
(booking) =>
77+
!booking.user ||
78+
!booking.user.isPlatformManaged ||
79+
(booking.user.isPlatformManaged && Boolean(booking.user.platformOAuthClients?.[0]?.areEmailsEnabled))
80+
);
81+
7382
const reminders = await prisma.reminderMail.findMany({
7483
where: {
7584
reminderType: ReminderType.PENDING_BOOKING_CONFIRMATION,
7685
referenceId: {
77-
in: bookings.map((b) => b.id),
86+
in: bookingsToRemind.map((b) => b.id),
7887
},
7988
elapsedMinutes: {
8089
gte: interval,

0 commit comments

Comments
 (0)