fix: Zod error caused by number-type responses (#23804)

* fix: getting zoderror due to number type responses

* update

* fix lint erro
This commit is contained in:
Anik Dhabal Babu
2025-09-17 15:01:21 +00:00
committed by GitHub
parent 81bd8033a9
commit bb6f5cca93
2 changed files with 4 additions and 11 deletions
@@ -1,5 +1,3 @@
import type { z } from "zod";
import { bookingResponsesDbSchema } from "@calcom/features/bookings/lib/getBookingResponsesSchema";
import slugify from "@calcom/lib/slugify";
import type { PrismaClient } from "@calcom/prisma";
@@ -115,10 +113,8 @@ export const getBookingWithResponses = <
) => {
return {
...booking,
responses: isSeatedEvent
? bookingResponsesDbSchema.parse(booking.responses || {})
: bookingResponsesDbSchema.parse(booking.responses || getResponsesFromOldBooking(booking)),
} as Omit<T, "responses"> & { responses: z.infer<typeof bookingResponsesDbSchema> };
responses: isSeatedEvent ? booking.responses : booking.responses || getResponsesFromOldBooking(booking),
} as Omit<T, "responses"> & { responses: Record<string, any> };
};
export default getBooking;
+2 -5
View File
@@ -1,6 +1,3 @@
import type { z } from "zod";
import { bookingResponsesDbSchema } from "@calcom/features/bookings/lib/getBookingResponsesSchema";
import slugify from "@calcom/lib/slugify";
import type { PrismaClient } from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
@@ -101,8 +98,8 @@ export const getBookingWithResponses = <
) => {
return {
...booking,
responses: bookingResponsesDbSchema.parse(booking.responses || getResponsesFromOldBooking(booking)),
} as Omit<T, "responses"> & { responses: z.infer<typeof bookingResponsesDbSchema> };
responses: booking.responses || getResponsesFromOldBooking(booking),
} as Omit<T, "responses"> & { responses: Record<string, any> };
};
export default getBooking;