Skip to content

Scheduling infrastructure for absolutely everyone.

fix: extract clientId header manually apiv2 (Revert) (#17832)

Morganc1112ab2ab53
diff --git a/apps/api/v2/src/ee/bookings/2024-04-15/controllers/bookings.controller.ts b/apps/api/v2/src/ee/bookings/2024-04-15/controllers/bookings.controller.ts
index e1a1f7c0c99..251824bf5fa 100644
--- a/apps/api/v2/src/ee/bookings/2024-04-15/controllers/bookings.controller.ts
+++ b/apps/api/v2/src/ee/bookings/2024-04-15/controllers/bookings.controller.ts
@@ -160,10 +160,10 @@ export class BookingsController_2024_04_15 {
@Post("/")
async createBooking(
@Req() req: BookingRequest,
- @Body() body: CreateBookingInput_2024_04_15
+ @Body() body: CreateBookingInput_2024_04_15,
+ @Headers(X_CAL_CLIENT_ID) clientId?: string
): Promise<ApiResponse<Partial<BookingResponse>>> {
- const clientIdHeader = req.get(X_CAL_CLIENT_ID);
- const oAuthClientId = clientIdHeader?.toString();
+ const oAuthClientId = clientId?.toString();
const { orgSlug, locationUrl } = body;
req.headers["x-cal-force-slug"] = orgSlug;
try {
@@ -191,10 +191,10 @@ export class BookingsController_2024_04_15 {
async cancelBooking(
@Req() req: BookingRequest,
@Param("bookingId") bookingId: string,
- @Body() _: CancelBookingInput_2024_04_15
+ @Body() _: CancelBookingInput_2024_04_15,
+ @Headers(X_CAL_CLIENT_ID) clientId?: string
): Promise<ApiResponse<{ bookingId: number; bookingUid: string; onlyRemovedAttendee: boolean }>> {
- const clientIdHeader = req.get(X_CAL_CLIENT_ID);
- const oAuthClientId = clientIdHeader?.toString();
+ const oAuthClientId = clientId?.toString();
if (bookingId) {
try {
req.body.id = parseInt(bookingId);
@@ -245,10 +245,10 @@ export class BookingsController_2024_04_15 {
@Post("/recurring")
async createRecurringBooking(
@Req() req: BookingRequest,
- @Body() _: CreateRecurringBookingInput_2024_04_15[]
+ @Body() _: CreateRecurringBookingInput_2024_04_15[],
+ @Headers(X_CAL_CLIENT_ID) clientId?: string
): Promise<ApiResponse<BookingResponse[]>> {
- const clientIdHeader = req.get(X_CAL_CLIENT_ID);
- const oAuthClientId = clientIdHeader?.toString();
+ const oAuthClientId = clientId?.toString();
try {
const recurringEventId = uuidv4();
for (const recurringEvent of req.body) {
@@ -283,10 +283,10 @@ export class BookingsController_2024_04_15 {
@Post("/instant")
async createInstantBooking(
@Req() req: BookingRequest,
- @Body() _: CreateBookingInput_2024_04_15
+ @Body() _: CreateBookingInput_2024_04_15,
+ @Headers(X_CAL_CLIENT_ID) clientId?: string
): Promise<ApiResponse<Awaited<ReturnType<typeof handleInstantMeeting>>>> {
- const clientIdHeader = req.get(X_CAL_CLIENT_ID);
- const oAuthClientId = clientIdHeader?.toString();
+ const oAuthClientId = clientId?.toString();
req.userId = (await this.getOwnerId(req)) ?? -1;
try {
const instantMeeting = await handleInstantMeeting(