revert: "feat: bulk shorten links with dub.links.createMany (#18539)" (#18587)

This reverts commit 4902c6a0f8.

Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Keith WilliamsandAlex van Andel authored and GitHub committed 2025-01-13 18:07:27 +00:00
1 parent 68f76e2acc
commit 35059d7727
3 files changed
+53 -21

No files matched your search

@@ -2,7 +2,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
import dayjs from "@calcom/dayjs";
import { bulkShortenLinks } from "@calcom/ee/workflows/lib/reminders/utils";
import { getShortenLink } from "@calcom/ee/workflows/lib/reminders/utils";
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import { defaultHandler } from "@calcom/lib/server";
@@ -127,8 +127,26 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
rescheduleLink: `${bookerUrl}/reschedule/${reminder.booking.uid}` || "",
};
const [{ shortLink: meetingUrl }, { shortLink: cancelLink }, { shortLink: rescheduleLink }] =
await bulkShortenLinks([urls.meetingUrl, urls.cancelLink, urls.rescheduleLink]);
const [meetingUrl, cancelLink, rescheduleLink] = await Promise.allSettled([
getShortenLink(urls.meetingUrl),
getShortenLink(urls.cancelLink),
getShortenLink(urls.rescheduleLink),
]).then((results) => {
return results.map((result) => {
let finalResult = "";
if (result.status === "fulfilled") {
const v = result.value;
if (typeof v === "string") {
finalResult = v;
} else {
finalResult = v.shortLink;
}
}
return finalResult;
});
});
const variables: VariablesType = {
eventName: reminder.booking?.eventType?.title,