Skip to content

Scheduling infrastructure for absolutely everyone.

fix: failing scheduleEmailReminder cron job (#11960)

Carina Wollendorfer0c92fbe11dc3
diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.ts
index 06aa08c447f..3ce801fb0fd 100644
--- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts
+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts
@@ -34,7 +34,11 @@ type Booking = Prisma.BookingGetPayload<{
};
}>;
-function getiCalEventAsString(booking: Booking) {
+function getiCalEventAsString(
+ booking: Pick<Booking, "startTime" | "endTime" | "description" | "location" | "user" | "attendees"> & {
+ eventType: { recurringEvent?: Prisma.JsonValue; title?: string } | null;
+ }
+) {
let recurrenceRule: string | undefined = undefined;
const recurringEvent = parseRecurringEvent(booking.eventType?.recurringEvent);
if (recurringEvent?.count) {
@@ -114,6 +118,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
},
skip: pageNumber * pageSize,
take: pageSize,
+ select: {
+ referenceId: true,
+ },
});
if (remindersToDelete.length === 0) {
@@ -156,6 +163,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
},
skip: pageNumber * pageSize,
take: pageSize,
+ select: {
+ referenceId: true,
+ id: true,
+ },
});
if (remindersToCancel.length === 0) {
@@ -203,13 +214,40 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
},
skip: pageNumber * pageSize,
take: pageSize,
- include: {
- workflowStep: true,
+ select: {
+ id: true,
+ scheduledDate: true,
+ workflowStep: {
+ select: {
+ action: true,
+ sendTo: true,
+ reminderBody: true,
+ emailSubject: true,
+ template: true,
+ sender: true,
+ includeCalendarEvent: true,
+ },
+ },
booking: {
- include: {
- eventType: true,
+ select: {
+ startTime: true,
+ endTime: true,
+ location: true,
+ description: true,
user: true,
+ metadata: true,
+ uid: true,
+ customInputs: true,
+ responses: true,
attendees: true,
+ eventType: {
+ select: {
+ bookingFields: true,
+ title: true,
+ slug: true,
+ recurringEvent: true,
+ },
+ },
},
},
},