chore: enable platform emails (#14471)
* feat: enable platform emails * fixup! feat: enable platform emails * fixup! fixup! feat: enable platform emails * fixup! Merge branch 'main' into chore-platform-emails * fixup! fixup! Merge branch 'main' into chore-platform-emails * fixup! fixup! fixup! Merge branch 'main' into chore-platform-emails * chore: add oauth client repo * chore: enable platform emails using oauth client * fix: call getConnectedCalendar with dbWrite since it creates destinationCalendar for new credentials * chore: update doc * fixup! chore: update doc * fixup! fixup! chore: update doc
This commit is contained in:
1 parent
19d938ed60
commit
e641bb3d57
18 files changed
+442
-142
No files matched your search
@@ -125,13 +125,24 @@ async function getBookingToDelete(id: number | undefined, uid: string | undefine
|
||||
export type CustomRequest = NextApiRequest & {
|
||||
userId?: number;
|
||||
bookingToDelete?: Awaited<ReturnType<typeof getBookingToDelete>>;
|
||||
platformClientId?: string;
|
||||
platformRescheduleUrl?: string;
|
||||
platformCancelUrl?: string;
|
||||
platformBookingUrl?: string;
|
||||
};
|
||||
|
||||
async function handler(req: CustomRequest) {
|
||||
const { id, uid, allRemainingBookings, cancellationReason, seatReferenceUid } =
|
||||
schemaBookingCancelParams.parse(req.body);
|
||||
req.bookingToDelete = await getBookingToDelete(id, uid);
|
||||
const { bookingToDelete, userId } = req;
|
||||
const {
|
||||
bookingToDelete,
|
||||
userId,
|
||||
platformBookingUrl,
|
||||
platformCancelUrl,
|
||||
platformClientId,
|
||||
platformRescheduleUrl,
|
||||
} = req;
|
||||
|
||||
if (!bookingToDelete || !bookingToDelete.user) {
|
||||
throw new HttpError({ statusCode: 400, message: "Booking not found" });
|
||||
@@ -269,6 +280,10 @@ async function handler(req: CustomRequest) {
|
||||
seatsShowAttendees: bookingToDelete.eventType?.seatsShowAttendees,
|
||||
iCalUID: bookingToDelete.iCalUID,
|
||||
iCalSequence: bookingToDelete.iCalSequence + 1,
|
||||
platformClientId,
|
||||
platformRescheduleUrl,
|
||||
platformCancelUrl,
|
||||
platformBookingUrl,
|
||||
};
|
||||
|
||||
const dataForWebhooks = { evt, webhooks, eventTypeInfo };
|
||||
|
||||
@@ -902,10 +902,16 @@ type BookingDataSchemaGetter =
|
||||
| typeof import("@calcom/features/bookings/lib/getBookingDataSchemaForApi").default;
|
||||
|
||||
async function handler(
|
||||
req: NextApiRequest & { userId?: number | undefined },
|
||||
req: NextApiRequest & {
|
||||
userId?: number | undefined;
|
||||
platformClientId?: string;
|
||||
platformRescheduleUrl?: string;
|
||||
platformCancelUrl?: string;
|
||||
platformBookingUrl?: string;
|
||||
},
|
||||
bookingDataSchemaGetter: BookingDataSchemaGetter = getBookingDataSchema
|
||||
) {
|
||||
const { userId } = req;
|
||||
const { userId, platformClientId, platformCancelUrl, platformBookingUrl, platformRescheduleUrl } = req;
|
||||
|
||||
// handle dynamic user
|
||||
let eventType =
|
||||
@@ -1503,6 +1509,10 @@ async function handler(
|
||||
schedulingType: eventType.schedulingType,
|
||||
iCalUID,
|
||||
iCalSequence,
|
||||
platformClientId,
|
||||
platformRescheduleUrl,
|
||||
platformCancelUrl,
|
||||
platformBookingUrl,
|
||||
};
|
||||
|
||||
if (req.body.thirdPartyRecurringEventId) {
|
||||
|
||||
Reference in new issue
Block a user