Files
2026-10-03 23:57:41 +02:00

19 lines
542 B
TypeScript

import { z } from 'zod'
const isoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Datum auswählen')
const requiredText = z.string().trim().min(1, 'Erst etwas schreiben')
export const newNoteSchema = z.object({
date: isoDate,
text: requiredText
})
export const newReviewSchema = z.object({
bookId: z.number({ error: 'Buch auswählen' }).int().positive('Buch auswählen'),
date: isoDate,
text: requiredText
})
export type NewNoteInput = z.output<typeof newNoteSchema>
export type NewReviewInput = z.output<typeof newReviewSchema>