Deleting zoom also works

This commit is contained in:
nicolas 2021-06-14 19:00:17 +02:00
parent c4455b74ba
commit 49abf06ce6

View file

@ -1,6 +1,7 @@
import prisma from '../../lib/prisma';
import {deleteEvent} from "../../lib/calendarClient";
import async from 'async';
import {deleteMeeting} from "../../lib/videoClient";
export default async function handler(req, res) {
if (req.method == "POST") {
@ -29,7 +30,11 @@ export default async function handler(req, res) {
const apiDeletes = async.mapLimit(bookingToDelete.user.credentials, 5, async (credential) => {
const bookingRefUid = bookingToDelete.references.filter((ref) => ref.type === credential.type)[0].uid;
if(credential.type.endsWith("_calendar")) {
return await deleteEvent(credential, bookingRefUid);
} else if(credential.type.endsWith("_video")) {
return await deleteMeeting(credential, bookingRefUid);
}
});
const attendeeDeletes = prisma.attendee.deleteMany({
where: {