From 1f9be423adaa605846c16773d2266b4629439b2b Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Thu, 20 Oct 2022 18:26:43 +0100 Subject: [PATCH] Set start and endTime to iso8601 (#198) --- lib/validations/booking.ts | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/validations/booking.ts b/lib/validations/booking.ts index 9d70d4c6d5..727ff0b1db 100644 --- a/lib/validations/booking.ts +++ b/lib/validations/booking.ts @@ -1,7 +1,7 @@ import { z } from "zod"; import { _BookingModel as Booking, _AttendeeModel, _UserModel } from "@calcom/prisma/zod"; -import { extendedBookingCreateBody } from "@calcom/prisma/zod-utils"; +import { extendedBookingCreateBody, iso8601 } from "@calcom/prisma/zod-utils"; import { schemaQueryUserId } from "./shared/queryUserId"; @@ -20,28 +20,32 @@ export const schemaBookingCreateBodyParams = extendedBookingCreateBody.merge(sch const schemaBookingEditParams = z .object({ title: z.string().optional(), - startTime: z.date().optional(), - endTime: z.date().optional(), + startTime: iso8601.optional(), + endTime: iso8601.optional(), }) .strict(); export const schemaBookingEditBodyParams = schemaBookingBaseBodyParams.merge(schemaBookingEditParams); export const schemaBookingReadPublic = Booking.extend({ - attendees: z.array( - _AttendeeModel.pick({ + attendees: z + .array( + _AttendeeModel.pick({ + email: true, + name: true, + timeZone: true, + locale: true, + }) + ) + .optional(), + user: _UserModel + .pick({ email: true, name: true, timeZone: true, locale: true, }) - ), - user: _UserModel.pick({ - email: true, - name: true, - timeZone: true, - locale: true, - }), + .optional(), }).pick({ id: true, userId: true,