fix: failing scheduleEmailReminder cron job (#11960)
Co-authored-by: CarinaWolli <wollencarina@gmail.com>pull/11962/head
parent
59fa713549
commit
0c92fbe11d
|
@ -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;
|
let recurrenceRule: string | undefined = undefined;
|
||||||
const recurringEvent = parseRecurringEvent(booking.eventType?.recurringEvent);
|
const recurringEvent = parseRecurringEvent(booking.eventType?.recurringEvent);
|
||||||
if (recurringEvent?.count) {
|
if (recurringEvent?.count) {
|
||||||
|
@ -114,6 +118,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
},
|
},
|
||||||
skip: pageNumber * pageSize,
|
skip: pageNumber * pageSize,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
|
select: {
|
||||||
|
referenceId: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (remindersToDelete.length === 0) {
|
if (remindersToDelete.length === 0) {
|
||||||
|
@ -156,6 +163,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
},
|
},
|
||||||
skip: pageNumber * pageSize,
|
skip: pageNumber * pageSize,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
|
select: {
|
||||||
|
referenceId: true,
|
||||||
|
id: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (remindersToCancel.length === 0) {
|
if (remindersToCancel.length === 0) {
|
||||||
|
@ -203,13 +214,40 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
},
|
},
|
||||||
skip: pageNumber * pageSize,
|
skip: pageNumber * pageSize,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
include: {
|
select: {
|
||||||
workflowStep: true,
|
id: true,
|
||||||
|
scheduledDate: true,
|
||||||
|
workflowStep: {
|
||||||
|
select: {
|
||||||
|
action: true,
|
||||||
|
sendTo: true,
|
||||||
|
reminderBody: true,
|
||||||
|
emailSubject: true,
|
||||||
|
template: true,
|
||||||
|
sender: true,
|
||||||
|
includeCalendarEvent: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
booking: {
|
booking: {
|
||||||
include: {
|
select: {
|
||||||
eventType: true,
|
startTime: true,
|
||||||
|
endTime: true,
|
||||||
|
location: true,
|
||||||
|
description: true,
|
||||||
user: true,
|
user: true,
|
||||||
|
metadata: true,
|
||||||
|
uid: true,
|
||||||
|
customInputs: true,
|
||||||
|
responses: true,
|
||||||
attendees: true,
|
attendees: true,
|
||||||
|
eventType: {
|
||||||
|
select: {
|
||||||
|
bookingFields: true,
|
||||||
|
title: true,
|
||||||
|
slug: true,
|
||||||
|
recurringEvent: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue