Fixed cancellation

This commit is contained in:
nicolas 2021-07-18 16:03:59 +02:00
parent 270e6b2d4f
commit 81e1287693
3 changed files with 31 additions and 8 deletions

View file

@ -157,7 +157,29 @@ const MicrosoftOffice365Calendar = (credential): CalendarApiAdapter => {
optional.location = { displayName: event.location }; optional.location = { displayName: event.location };
} }
return toRet; return {
subject: event.title,
body: {
contentType: "HTML",
content: event.description,
},
start: {
dateTime: event.startTime,
timeZone: event.organizer.timeZone,
},
end: {
dateTime: event.endTime,
timeZone: event.organizer.timeZone,
},
attendees: event.attendees.map((attendee) => ({
emailAddress: {
address: attendee.email,
name: attendee.name,
},
type: "required",
})),
...optional,
};
}; };
const integrationType = "office365_calendar"; const integrationType = "office365_calendar";

View file

@ -33,9 +33,8 @@ export default class EventManager {
} }
public async create(event: CalendarEvent): Promise<Array<EventResult>> { public async create(event: CalendarEvent): Promise<Array<EventResult>> {
const results: Array<EventResult> = [];
// First, create all calendar events. // First, create all calendar events.
results.concat(await this.createAllCalendarEvents(event)); const results: Array<EventResult> = await this.createAllCalendarEvents(event);
// If and only if event type is a video meeting, create a video meeting as well. // If and only if event type is a video meeting, create a video meeting as well.
if (EventManager.isIntegration(event.location)) { if (EventManager.isIntegration(event.location)) {

View file

@ -29,11 +29,13 @@ export default async function handler(req, res) {
}); });
const apiDeletes = async.mapLimit(bookingToDelete.user.credentials, 5, async (credential) => { const apiDeletes = async.mapLimit(bookingToDelete.user.credentials, 5, async (credential) => {
const bookingRefUid = bookingToDelete.references.filter((ref) => ref.type === credential.type)[0].uid; const bookingRefUid = bookingToDelete.references.filter((ref) => ref.type === credential.type)[0]?.uid;
if (credential.type.endsWith("_calendar")) { if (bookingRefUid) {
return await deleteEvent(credential, bookingRefUid); if (credential.type.endsWith("_calendar")) {
} else if (credential.type.endsWith("_video")) { return await deleteEvent(credential, bookingRefUid);
return await deleteMeeting(credential, bookingRefUid); } else if (credential.type.endsWith("_video")) {
return await deleteMeeting(credential, bookingRefUid);
}
} }
}); });
const attendeeDeletes = prisma.attendee.deleteMany({ const attendeeDeletes = prisma.attendee.deleteMany({