28 lines
815 B
TypeScript
28 lines
815 B
TypeScript
import { z } from "zod"
|
|
|
|
const optionalPositiveInteger = z.preprocess(
|
|
(value) => {
|
|
if (typeof value !== "string") return null
|
|
|
|
const trimmed = value.trim()
|
|
return trimmed.length > 0 ? trimmed : null
|
|
},
|
|
z.coerce.number().int().positive().nullable(),
|
|
)
|
|
|
|
export const toastRequestSchema = z.object({
|
|
memberId: z.uuid().nullable(),
|
|
speakerName: z.string().trim().min(1).max(160),
|
|
estimatedMinutes: optionalPositiveInteger,
|
|
})
|
|
|
|
export const interactionSubmissionSchema = z.object({
|
|
invitationId: z.uuid(),
|
|
toastRequest: toastRequestSchema.nullable(),
|
|
})
|
|
|
|
export const toastStatusSchema = z.enum(["pending", "accepted", "declined", "scheduled"])
|
|
|
|
export type InteractionSubmissionInput = z.infer<typeof interactionSubmissionSchema>
|
|
export type ToastStatus = z.infer<typeof toastStatusSchema>
|