From 1bdfa9f3d2d6e78437085f8e92ee15ddabcd6627 Mon Sep 17 00:00:00 2001 From: Paperclip Date: Tue, 14 Apr 2026 13:59:51 +0000 Subject: [PATCH] fix(book): add future-time refinement to booking startTime --- apps/api/src/routes/book.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/routes/book.ts b/apps/api/src/routes/book.ts index d82823f..f74405c 100644 --- a/apps/api/src/routes/book.ts +++ b/apps/api/src/routes/book.ts @@ -102,7 +102,10 @@ bookRouter.get("/availability", async (c) => { const bookingSchema = z.object({ serviceId: z.string().uuid(), - startTime: z.string().datetime(), + startTime: z.string().datetime().refine( + (dt) => new Date(dt) > new Date(), + { message: "Appointment must be in the future" } + ), clientName: z.string().min(1).max(200), clientEmail: z.string().email(), clientPhone: z.string().max(50).optional(),