From c4455b74ba6ed7a7ffe59516bb79e380a4a747a1 Mon Sep 17 00:00:00 2001 From: nicolas Date: Mon, 14 Jun 2021 18:55:20 +0200 Subject: [PATCH] Rescheduling zoom works --- pages/api/book/[user].ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pages/api/book/[user].ts b/pages/api/book/[user].ts index 31182d3e05..302bcd29c3 100644 --- a/pages/api/book/[user].ts +++ b/pages/api/book/[user].ts @@ -5,7 +5,7 @@ import createConfirmBookedEmail from "../../../lib/emails/confirm-booked"; import async from 'async'; import {v5 as uuidv5} from 'uuid'; import short from 'short-uuid'; -import {createMeeting, VideoMeeting} from "../../../lib/videoClient"; +import {createMeeting, updateMeeting, VideoMeeting} from "../../../lib/videoClient"; const translator = short(); @@ -101,12 +101,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }); // Use all integrations - results = await async.mapLimit(calendarCredentials, 5, async (credential) => { + results = results.concat(await async.mapLimit(calendarCredentials, 5, async (credential) => { const bookingRefUid = booking.references.filter((ref) => ref.type === credential.type)[0].uid; return await updateEvent(credential, bookingRefUid, appendLinksToEvents(evt)) - }); + })); - //TODO: Reschedule with videoCredentials as well + results = results.concat(await async.mapLimit(videoCredentials, 5, async (credential) => { + const bookingRefUid = booking.references.filter((ref) => ref.type === credential.type)[0].uid; + return await updateMeeting(credential, bookingRefUid, meeting) // TODO Maybe append links? + })); // Clone elements referencesToCreate = [...booking.references]; @@ -154,7 +157,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) referencesToCreate = results.map((result => { return { type: result.type, - uid: result.response.uuid ?? result.response.id + uid: result.response.id.toString() }; })); }