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 069b1a52bf..cb48de9e5a 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 @@ -355,13 +355,14 @@ export class BookingsController_2024_04_15 { oAuthClientId?: string, platformBookingLocation?: string ): Promise { + const clone = { ...req }; const userId = (await this.getOwnerId(req)) ?? -1; const oAuthParams = oAuthClientId ? await this.getOAuthClientsParams(oAuthClientId) : DEFAULT_PLATFORM_PARAMS; - Object.assign(req, { userId, ...oAuthParams, platformBookingLocation }); - req.body = { ...req.body, noEmail: !oAuthParams.arePlatformEmailsEnabled }; - return req as unknown as NextApiRequest & { userId?: number } & OAuthRequestParams; + Object.assign(clone, { userId, ...oAuthParams, platformBookingLocation }); + clone.body = { ...clone.body, noEmail: !oAuthParams.arePlatformEmailsEnabled }; + return clone as unknown as NextApiRequest & { userId?: number } & OAuthRequestParams; } private async createNextApiRecurringBookingRequest( @@ -369,17 +370,18 @@ export class BookingsController_2024_04_15 { oAuthClientId?: string, platformBookingLocation?: string ): Promise { + const clone = { ...req }; const userId = (await this.getOwnerId(req)) ?? -1; const oAuthParams = oAuthClientId ? await this.getOAuthClientsParams(oAuthClientId) : DEFAULT_PLATFORM_PARAMS; - Object.assign(req, { + Object.assign(clone, { userId, ...oAuthParams, platformBookingLocation, noEmail: !oAuthParams.arePlatformEmailsEnabled, }); - return req as unknown as NextApiRequest & { userId?: number } & OAuthRequestParams; + return clone as unknown as NextApiRequest & { userId?: number } & OAuthRequestParams; } private handleBookingErrors(