* feat: create new markNoShow endpoint * chore: add schema * chore: update name * chore: save progress * refactor: improve code and types * fix: unit test * chore: improvements * chore: move query to booking repository * fix: type error
27 lines
629 B
TypeScript
27 lines
629 B
TypeScript
import { z } from "zod";
|
|
|
|
export const ZNoShowInputSchema = z
|
|
.object({
|
|
bookingUid: z.string(),
|
|
attendees: z
|
|
.array(
|
|
z.object({
|
|
email: z.string(),
|
|
noShow: z.boolean(),
|
|
})
|
|
)
|
|
.optional(),
|
|
noShowHost: z.boolean().optional(),
|
|
})
|
|
.refine(
|
|
(data) => {
|
|
return (data.attendees && data.attendees.length > 0) || data.noShowHost !== undefined;
|
|
},
|
|
{
|
|
message: "At least one of 'attendees' or 'noShowHost' must be provided",
|
|
path: ["attendees", "noShowHost"],
|
|
}
|
|
);
|
|
|
|
export type TNoShowInputSchema = z.infer<typeof ZNoShowInputSchema>;
|