Request reschedule send correct ics file

write-icaluid-to-booking
Joe Au-Yeung 2023-10-26 16:57:11 -04:00
parent 8371a311b1
commit f050f0c869
2 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
icalEvent: { icalEvent: {
filename: "event.ics", filename: "event.ics",
content: this.getiCalEventAsString(), content: this.getiCalEventAsString(),
method: "request",
}, },
from: `${APP_NAME} <${this.getMailerOptions().from}>`, from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","), to: toAddresses.join(","),
@ -42,6 +43,8 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
// @OVERRIDE // @OVERRIDE
protected getiCalEventAsString(): string | undefined { protected getiCalEventAsString(): string | undefined {
const icsEvent = createEvent({ const icsEvent = createEvent({
uid: this.calEvent.iCalUID || this.calEvent.uid!,
sequence: 100,
start: dayjs(this.calEvent.startTime) start: dayjs(this.calEvent.startTime)
.utc() .utc()
.toArray() .toArray()
@ -61,7 +64,7 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
email: attendee.email, email: attendee.email,
})), })),
status: "CANCELLED", status: "CANCELLED",
method: "CANCEL", method: "REQUEST",
}); });
if (icsEvent.error) { if (icsEvent.error) {
throw icsEvent.error; throw icsEvent.error;

View File

@ -62,6 +62,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
scheduledJobs: true, scheduledJobs: true,
workflowReminders: true, workflowReminders: true,
responses: true, responses: true,
iCalUID: true,
}, },
where: { where: {
uid: bookingId, uid: bookingId,
@ -176,6 +177,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
tAttendees tAttendees
), ),
organizer: userAsPeopleType, organizer: userAsPeopleType,
iCalUID: bookingToReschedule.iCalUID,
}); });
const director = new CalendarEventDirector(); const director = new CalendarEventDirector();
@ -246,6 +248,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
? [bookingToReschedule?.destinationCalendar] ? [bookingToReschedule?.destinationCalendar]
: [], : [],
cancellationReason: `Please reschedule. ${cancellationReason}`, // TODO::Add i18-next for this cancellationReason: `Please reschedule. ${cancellationReason}`, // TODO::Add i18-next for this
iCalUID: bookingToReschedule?.iCalUID,
}; };
// Send webhook // Send webhook