chore: Couple fixes to improve error reporting (#16895)

* chore: Couple fixes to improve error reporting

* tweak: Fix error message

* refactor: Use findUniqueOrThrow instead of guard

* fix: Broken test, missing ID - suspect it passes because only one record exists

* chore: Minor refactor to split ZodEffect from ZodType

* fix: Satify typescript
This commit is contained in:
Alex van Andel authored and GitHub committed 2024-10-01 09:18:51 -03:00
1 parent 4b6a389212
commit a95729f4a1
9 files changed
+31 -28

No files matched your search

+10 -1
View File
@@ -314,7 +314,7 @@ export const bookingCreateBodySchemaForApi = extendedBookingCreateBody.merge(
bookingCreateSchemaLegacyPropsForApi.partial()
);
export const schemaBookingCancelParams = z.object({
export const bookingCancelSchema = z.object({
id: z.number().optional(),
uid: z.string().optional(),
allRemainingBookings: z.boolean().optional(),
@@ -323,6 +323,15 @@ export const schemaBookingCancelParams = z.object({
cancelledBy: z.string().email({ message: "Invalid email" }).optional(),
});
export const bookingCancelAttendeeSeatSchema = z.object({
seatReferenceUid: z.string(),
});
export const bookingCancelInput = bookingCancelSchema.refine(
(data) => !!data.id || !!data.uid,
"At least one of the following required: 'id', 'uid'."
);
export const vitalSettingsUpdateSchema = z.object({
connected: z.boolean().optional(),
selectedParam: z.string().optional(),