fix: add required property on input (#3934)

* fix: add required property on input

* chore: remove console

* fix: add check in /api/book for custom inputs

* chore: var name

* wip:try zod

* fix: change zod validation

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Udit Takkar
2022-08-29 13:04:22 +00:00
committed by GitHub
co-authored by Peer Richelsen kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent 85cc62d0cb
commit 00c00a9aee
3 changed files with 25 additions and 1 deletions
+7
View File
@@ -87,6 +87,13 @@ export const bookingCreateBodySchema = z.object({
hashedLink: z.string().nullish(),
});
export const requiredCustomInputSchema = z.union([
// string must be given & nonempty
z.string().trim().min(1),
// boolean must be true if set.
z.boolean().refine((v) => v === true),
]);
export type BookingCreateBody = z.input<typeof bookingCreateBodySchema>;
export const bookingConfirmPatchBodySchema = z.object({