feat: add integration options for API v2 update booking location endpoint (#26363)

* init: improvements for update location endpoint

* chore: init function to update calendar event

* fix: bad imports

* chore: update calendar event when updating location

* chore: update platform libraries

* fix: update calendar event

* chore: update platform libraries

* chore: cleanup

* feat: add logic for video conferecing integrations

* chore: update platform libraries

* feat: add sms and email notifications

* chore: update e2e tests

* chore: update openapi spec

* chore: implement cubic feedback

* chore: update openapi spec

* fix: add Jest mock for Daily.co video adapter in e2e test

Co-Authored-By: [email protected] <[email protected]>

* fix: mock createMeeting directly to bypass database check in e2e test

Co-Authored-By: [email protected] <[email protected]>

* chore: implement PR feedback

* chore: implement feedback

* fix: mock throttler guard to prevent rate limiting in e2e tests

Co-Authored-By: [email protected] <[email protected]>

* fix: merge conflicts

* chore: update platform libraries

* chore: implement feedback part 1

* chore: implement feedback part 2

* chore: remove unnecessary type casting

* chore: implement cubic feedback

* chore: implement devin feedback

* chore: implement PR feedback

* fix: type error

* chore: update openapi spec

* test: add mocks and tests for Google Meet and Microsoft Teams integration location updates

Co-Authored-By: [email protected] <[email protected]>

* refactor: simplify service code - extract shared helpers, remove duplication

Co-Authored-By: [email protected] <[email protected]>

* feat: implement fixtures for bookings references

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-03-17 15:15:17 +05:30
1 parent 4291a59b2c
commit 089a39f59f
18 files changed
+1341 -53

No files matched your search

+6 -2
View File
@@ -19,7 +19,11 @@ export { BookingEmailAndSmsTasker } from "@calcom/features/bookings/lib/tasker/B
export { BookingEmailAndSmsTaskService } from "@calcom/features/bookings/lib/tasker/BookingEmailAndSmsTaskService";
export { BookingEmailAndSmsTriggerDevTasker } from "@calcom/features/bookings/lib/tasker/BookingEmailAndSmsTriggerTasker";
export { BookingAttendeesService } from "@calcom/features/bookings/services/BookingAttendeesService";
export { getWebhookProducer } from "@calcom/features/di/webhooks/containers/webhook";
export { PrismaOrgMembershipRepository } from "@calcom/features/membership/repositories/PrismaOrgMembershipRepository";
export { addGuestsHandler } from "@calcom/trpc/server/routers/viewer/bookings/addGuests.handler";
export type { IWebhookProducerService } from "@calcom/features/webhooks/lib/interface/WebhookProducerService";
export { getWebhookProducer } from "@calcom/features/di/webhooks/containers/webhook";
export {
type BookingWithUserAndEventDetails,
bookingWithUserAndEventDetailsSelect,
} from "@calcom/prisma/selects/booking";
export { addGuestsHandler } from "@calcom/trpc/server/routers/viewer/bookings/addGuests.handler";
@@ -3,6 +3,11 @@ export {
getDownloadLinkOfCalVideoByRecordingId,
getAllTranscriptsAccessLinkFromRoomName,
getCalVideoMeetingSessionsByRoomName,
createMeeting,
updateMeeting,
deleteMeeting,
} from "@calcom/features/conferencing/lib/videoClient";
export { FAKE_DAILY_CREDENTIAL } from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
export type { CalMeetingParticipant, CalMeetingSession } from "@calcom/app-store/dailyvideo/zod";
+24 -5
View File
@@ -1,4 +1,3 @@
import { getTranslation } from "@calcom/i18n/server";
import { getBookingForReschedule } from "@calcom/features/bookings/lib/get-booking";
import getAllUserBookings from "@calcom/features/bookings/lib/getAllUserBookings";
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
@@ -13,6 +12,7 @@ import {
import { handleCreatePhoneCall } from "@calcom/features/handleCreatePhoneCall";
import handleMarkNoShow from "@calcom/features/handleMarkNoShow";
import { getRoutedUrl } from "@calcom/features/routing-forms/lib/getRoutedUrl";
import { getTranslation } from "@calcom/i18n/server";
import { symmetricDecrypt, symmetricEncrypt } from "@calcom/lib/crypto";
import type { Prisma } from "@calcom/prisma/client";
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
@@ -23,13 +23,13 @@ export { slugify } from "@calcom/lib/slugify";
export { slugifyLenient } from "@calcom/lib/slugify-lenient";
export { getBookingForReschedule };
export { getWebhookProducer } from "@calcom/features/di/webhooks/containers/webhook";
export { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
export {
DEFAULT_WEBHOOK_VERSION,
WebhookVersion,
} from "@calcom/features/webhooks/lib/interface/IWebhookRepository";
export type { IWebhookProducerService } from "@calcom/features/webhooks/lib/interface/WebhookProducerService";
export { getWebhookProducer } from "@calcom/features/di/webhooks/containers/webhook";
export {
AttributeType,
CreationSource,
@@ -42,7 +42,7 @@ export {
WorkflowTemplates,
WorkflowTriggerEvents,
} from "@calcom/prisma/enums";
export type { EventBusyDate } from "@calcom/types/Calendar";
export type { CalendarEvent, EventBusyDate } from "@calcom/types/Calendar";
export { handleMarkNoShow };
export { handleCreatePhoneCall };
@@ -52,7 +52,10 @@ export type {
BookingResponse,
} from "@calcom/features/bookings/types";
export type { ConnectedCalendar } from "@calcom/features/calendars/lib/CalendarManager";
export { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
export {
getBusyCalendarTimes,
updateEvent,
} from "@calcom/features/calendars/lib/CalendarManager";
export type { ConnectedDestinationCalendars } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
export { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
export type { CityTimezones } from "@calcom/features/cityTimezones/cityTimezonesHandler";
@@ -68,7 +71,11 @@ export { handleCancelBooking };
export { dynamicEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
export { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
export { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
export { bookingMetadataSchema, teamMetadataSchema, userMetadata } from "@calcom/prisma/zod-utils";
export {
bookingMetadataSchema,
teamMetadataSchema,
userMetadata,
} from "@calcom/prisma/zod-utils";
export { symmetricEncrypt, symmetricDecrypt };
@@ -117,9 +124,12 @@ export type { TFindTeamMembersMatchingAttributeLogicInputSchema } from "@calcom/
export { verifyPhoneNumber, sendVerificationCode };
export { sendLocationChangeEmailsAndSMS } from "@calcom/emails/email-manager";
export { verifyCodeUnAuthenticated } from "@calcom/features/auth/lib/verifyCodeUnAuthenticated";
export { sendEmailVerificationByCode } from "@calcom/features/auth/lib/verifyEmail";
export { BookingReferenceRepository } from "@calcom/features/bookingReference/repositories/BookingReferenceRepository";
export { BookingAccessService } from "@calcom/features/bookings/services/BookingAccessService";
export { CredentialRepository } from "@calcom/features/credentials/repositories/CredentialRepository";
export type { OrgMembershipLookup } from "@calcom/features/di/modules/OrgMembershipLookup";
export { StripeBillingService } from "@calcom/features/ee/billing/service/billingProvider/StripeBillingService";
export { TeamService } from "@calcom/features/ee/teams/services/teamService";
@@ -129,7 +139,16 @@ export { generateSecret } from "@calcom/features/oauth/utils/generateSecret";
export { ProfileRepository } from "@calcom/features/profile/repositories/ProfileRepository";
export type { Tasker } from "@calcom/features/tasker/tasker";
export { getTasker } from "@calcom/features/tasker/tasker-factory";
export { buildCalEventFromBooking } from "@calcom/lib/buildCalEventFromBooking";
export { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
export { verifyCodeChallenge } from "@calcom/lib/pkce";
export { validateUrlForSSRFSync } from "@calcom/lib/ssrfProtection";
export type { TraceContext } from "@calcom/lib/tracing";
export { distributedTracing } from "@calcom/lib/tracing/factory";
export {
type BookingWithUserAndEventDetails,
bookingWithUserAndEventDetailsSelect,
} from "@calcom/prisma/selects/booking";
export { checkEmailVerificationRequired } from "@calcom/trpc/server/routers/publicViewer/checkIfUserEmailVerificationRequired.handler";
export { verifyCode as verifyCodeAuthenticated } from "@calcom/trpc/server/routers/viewer/organizations/verifyCode.handler";
export type { CredentialForCalendarService } from "@calcom/types/Credential";
@@ -13,6 +13,7 @@ import {
BookingInputAttendeePhoneLocation_2024_08_13,
BookingInputLinkLocation_2024_08_13,
BookingInputPhoneLocation_2024_08_13,
BookingInputIntegrationLocation_2024_08_13,
} from "./location.input";
export class UpdateInputAddressLocation_2024_08_13 extends BookingInputAddressLocation_2024_08_13 {
@@ -43,13 +44,16 @@ export class UpdateBookingInputPhoneLocation_2024_08_13 extends BookingInputPhon
phone!: string;
}
export class UpdateBookingInputIntegrationLocation_2024_08_13 extends BookingInputIntegrationLocation_2024_08_13 {}
export type UpdateBookingInputLocation_2024_08_13 =
| UpdateInputAddressLocation_2024_08_13
| UpdateBookingInputAttendeeAddressLocation_2024_08_13
| UpdateBookingInputAttendeeDefinedLocation_2024_08_13
| UpdateBookingInputAttendeePhoneLocation_2024_08_13
| UpdateBookingInputLinkLocation_2024_08_13
| UpdateBookingInputPhoneLocation_2024_08_13;
| UpdateBookingInputPhoneLocation_2024_08_13
| UpdateBookingInputIntegrationLocation_2024_08_13;
@ValidatorConstraint({ async: true })
class UpdateBookingInputLocationValidator_2024_08_13 implements ValidatorConstraintInterface {
@@ -62,6 +66,7 @@ class UpdateBookingInputLocationValidator_2024_08_13 implements ValidatorConstra
attendeePhone: UpdateBookingInputAttendeePhoneLocation_2024_08_13,
link: UpdateBookingInputLinkLocation_2024_08_13,
phone: UpdateBookingInputPhoneLocation_2024_08_13,
integration: UpdateBookingInputIntegrationLocation_2024_08_13,
};
async validate(location: { type: string }) {
@@ -73,7 +78,7 @@ class UpdateBookingInputLocationValidator_2024_08_13 implements ValidatorConstra
const ClassType = this.classTypeMap[type];
if (!ClassType) {
this.validationMessage = `UpdateBookingInputLocationValidator_2024_08_13 - Unsupported booking location type '${type}'. Valid types are address, link, phone, attendeePhone, attendeeAddress, and attendeeDefined.`;
this.validationMessage = `UpdateBookingInputLocationValidator_2024_08_13 - Unsupported booking location type '${type}'. Valid types are address, link, phone, attendeePhone, attendeeAddress, attendeeDefined, and integration.`;
return false;
}
@@ -115,7 +120,8 @@ export function ValidateUpdateBookingLocation_2024_08_13(validationOptions?: Val
UpdateBookingInputAttendeeDefinedLocation_2024_08_13,
UpdateBookingInputAttendeePhoneLocation_2024_08_13,
UpdateBookingInputLinkLocation_2024_08_13,
UpdateBookingInputPhoneLocation_2024_08_13
UpdateBookingInputPhoneLocation_2024_08_13,
UpdateBookingInputIntegrationLocation_2024_08_13
)
export class UpdateBookingLocationInput_2024_08_13 {
@IsOptional()
@@ -130,6 +136,7 @@ export class UpdateBookingLocationInput_2024_08_13 {
{ $ref: getSchemaPath(UpdateBookingInputAttendeePhoneLocation_2024_08_13) },
{ $ref: getSchemaPath(UpdateBookingInputLinkLocation_2024_08_13) },
{ $ref: getSchemaPath(UpdateBookingInputPhoneLocation_2024_08_13) },
{ $ref: getSchemaPath(UpdateBookingInputIntegrationLocation_2024_08_13) },
],
})
location?: UpdateBookingInputLocation_2024_08_13;
+103
View File
@@ -27,3 +27,106 @@ export const bookingDetailsSelect = {
},
},
} satisfies Prisma.BookingSelect;
export const bookingWithUserAndEventDetailsSelect = {
title: true,
description: true,
startTime: true,
endTime: true,
userPrimaryEmail: true,
uid: true,
iCalUID: true,
iCalSequence: true,
eventTypeId: true,
id: true,
userId: true,
location: true,
responses: true,
metadata: true,
destinationCalendar: {
select: {
id: true,
integration: true,
externalId: true,
primaryEmail: true,
userId: true,
eventTypeId: true,
credentialId: true,
delegationCredentialId: true,
domainWideDelegationCredentialId: true,
createdAt: true,
updatedAt: true,
customCalendarReminder: true,
},
},
attendees: {
select: {
email: true,
name: true,
timeZone: true,
locale: true,
},
},
references: {
select: {
id: true,
type: true,
uid: true,
deleted: true,
credentialId: true,
delegationCredentialId: true,
externalCalendarId: true,
},
},
user: {
select: {
email: true,
name: true,
timeZone: true,
locale: true,
credentials: {
select: {
id: true,
type: true,
delegationCredentialId: true,
},
},
destinationCalendar: {
select: {
id: true,
integration: true,
externalId: true,
primaryEmail: true,
userId: true,
eventTypeId: true,
credentialId: true,
delegationCredentialId: true,
domainWideDelegationCredentialId: true,
createdAt: true,
updatedAt: true,
customCalendarReminder: true,
},
},
profiles: {
select: {
organizationId: true,
},
},
},
},
eventType: {
select: {
title: true,
metadata: true,
recurringEvent: true,
seatsPerTimeSlot: true,
seatsShowAttendees: true,
hideOrganizerEmail: true,
customReplyToEmail: true,
},
},
} satisfies Prisma.BookingSelect;
export type BookingWithUserAndEventDetails = Prisma.BookingGetPayload<{
select: typeof bookingWithUserAndEventDetailsSelect;
}>;