fix: Allow zero routingFormResponseId in API v2 available endpoint (#21301)

* Allow zero routingFormResponseId

* fix: conditionally validate routingFormResponseId to allow 0 only for dry run operations

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

* fix: pass _isDryRun parameter to API v2 available endpoint

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

* fix runtime error and improve message

* Add e2e test to verify the constraint works

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-05-16 12:23:11 +05:30
1 parent 5bc9d71a88
commit fab364f084
3 files changed
+115 -1

No files matched your search

@@ -2,6 +2,7 @@ import { useSearchParams } from "next/navigation";
import { updateEmbedBookerState } from "@calcom/embed-core/src/embed-iframe";
import { useBookerStore } from "@calcom/features/bookings/Booker/store";
import { isBookingDryRun } from "@calcom/features/bookings/Booker/utils/isBookingDryRun";
import { useTimesForSchedule } from "@calcom/features/schedules/lib/use-schedule/useTimesForSchedule";
import { getRoutedTeamMemberIdsFromSearchParams } from "@calcom/lib/bookings/getRoutedTeamMemberIdsFromSearchParams";
import { PUBLIC_QUERY_AVAILABLE_SLOTS_INTERVAL_SECONDS } from "@calcom/lib/constants";
@@ -97,6 +98,7 @@ export const useSchedule = ({
email,
// Ensures that connectVersion causes a refresh of the data
...(embedConnectVersion ? { embedConnectVersion } : {}),
_isDryRun: searchParams ? isBookingDryRun(searchParams) : false,
};
const options = {