mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
23 lines
541 B
TypeScript
23 lines
541 B
TypeScript
import { z } from 'zod';
|
|
|
|
const BeerCommentValidationSchema = z.object({
|
|
content: z
|
|
.string()
|
|
.min(1, {
|
|
message: 'Comment must not be empty.',
|
|
})
|
|
.max(300, {
|
|
message: 'Comment must be less than 300 characters.',
|
|
}),
|
|
rating: z
|
|
.number()
|
|
.int()
|
|
.min(1, { message: 'Rating must be greater than 1.' })
|
|
.max(5, { message: 'Rating must be less than 5.' }),
|
|
beerPostId: z.string().uuid({
|
|
message: 'Beer post ID must be a valid UUID.',
|
|
}),
|
|
});
|
|
|
|
export default BeerCommentValidationSchema;
|