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

View File

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