diff --git a/apps/api/v2/src/modules/slots/slots-2024-04-15/services/slots.service.ts b/apps/api/v2/src/modules/slots/slots-2024-04-15/services/slots.service.ts index f1f12035bd..e97ab48e1b 100644 --- a/apps/api/v2/src/modules/slots/slots-2024-04-15/services/slots.service.ts +++ b/apps/api/v2/src/modules/slots/slots-2024-04-15/services/slots.service.ts @@ -1,10 +1,8 @@ import { EventTypesRepository_2024_04_15 } from "@/ee/event-types/event-types_2024_04_15/event-types.repository"; import { SlotsRepository_2024_04_15 } from "@/modules/slots/slots-2024-04-15/slots.repository"; -import { Injectable, NotFoundException, BadRequestException } from "@nestjs/common"; -import { DateTime } from "luxon"; +import { Injectable, NotFoundException } from "@nestjs/common"; import { v4 as uuid } from "uuid"; -import { SlotFormat } from "@calcom/platform-enums"; import { ReserveSlotInput_2024_04_15 } from "@calcom/platform-types"; @Injectable() @@ -33,7 +31,7 @@ export class SlotsService_2024_04_15 { } } - if (eventType && shouldReserveSlot) { + if (eventType && shouldReserveSlot && !input._isDryRun) { await Promise.all( eventType.users.map((user) => this.slotsRepo.upsertSelectedSlot(user.id, input, uid, eventType.seatsPerTimeSlot !== null) diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx index 0197bb9ff0..eeb5d3159f 100644 --- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx +++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx @@ -403,6 +403,7 @@ export const BookerPlatformWrapper = ( onReserveSlotError: props.onReserveSlotError, onDeleteSlotSuccess: props.onDeleteSlotSuccess, onDeleteSlotError: props.onDeleteSlotError, + isBookingDryRun: routingParams?.isBookingDryRun, }); const { data: connectedCalendars, isPending: fetchingConnectedCalendars } = useConnectedCalendars({ diff --git a/packages/platform/atoms/hooks/useSlots.ts b/packages/platform/atoms/hooks/useSlots.ts index 60d15d2fba..faf5ca8764 100644 --- a/packages/platform/atoms/hooks/useSlots.ts +++ b/packages/platform/atoms/hooks/useSlots.ts @@ -26,7 +26,13 @@ export type UseSlotsReturnType = ReturnType; export const useSlots = ( event: { data?: Pick | null }, - { onReserveSlotSuccess, onReserveSlotError, onDeleteSlotSuccess, onDeleteSlotError }: UseSlotsCallbacks = {} + { + onReserveSlotSuccess, + onReserveSlotError, + onDeleteSlotSuccess, + onDeleteSlotError, + isBookingDryRun, + }: UseSlotsCallbacks & { isBookingDryRun?: boolean } = {} ) => { const selectedDuration = useBookerStore((state) => state.selectedDuration); const [selectedTimeslot, setSelectedTimeslot] = useBookerStore( @@ -64,6 +70,7 @@ export const useSlots = ( .utc() .add(selectedDuration || event.data.length, "minutes") .format(), + _isDryRun: isBookingDryRun, }); } }; diff --git a/packages/platform/types/slots/slots-2024-04-15/inputs/index.ts b/packages/platform/types/slots/slots-2024-04-15/inputs/index.ts index af937ad9ef..b225caf390 100644 --- a/packages/platform/types/slots/slots-2024-04-15/inputs/index.ts +++ b/packages/platform/types/slots/slots-2024-04-15/inputs/index.ts @@ -164,4 +164,9 @@ export class ReserveSlotInput_2024_04_15 { description: "Optional but only for events with seats. Used to retrieve booking of a seated event.", }) bookingUid?: string; + + @IsBoolean() + @IsOptional() + @ApiHideProperty() + _isDryRun?: boolean; }