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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user