Add like count and extracted like button out of parent

This commit is contained in:
Aaron William Po
2023-02-15 21:35:18 -05:00
parent 5561f209e9
commit d50ce7497b
6 changed files with 97 additions and 68 deletions

View File

@@ -4,7 +4,7 @@ export const BeerCommentQueryResult = z.object({
id: z.string().uuid(),
content: z.string().min(1).max(300),
rating: z.number().int().min(1).max(5),
createdAt: z.date().or(z.string().datetime()),
createdAt: z.coerce.date(),
postedBy: z.object({
id: z.string().uuid(),
username: z.string().min(1).max(50),

View File

@@ -3,20 +3,14 @@ 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.',
}),
.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.',
}),
beerPostId: z.string().uuid({ message: 'Beer post ID must be a valid UUID.' }),
});
export default BeerCommentValidationSchema;