Work on brewery page, refactors

Refactor query types to explicitly use z.infer
This commit is contained in:
Aaron William Po
2023-03-31 21:13:35 -04:00
parent d8a8dad37f
commit b69dbc95b4
33 changed files with 308 additions and 243 deletions

View File

@@ -1,8 +1,8 @@
import { z } from 'zod';
export const BeerCommentQueryResult = z.object({
const BeerCommentQueryResult = z.object({
id: z.string().uuid(),
content: z.string().min(1).max(300),
content: z.string().min(1).max(500),
rating: z.number().int().min(1).max(5),
createdAt: z.coerce.date(),
postedBy: z.object({
@@ -10,6 +10,5 @@ export const BeerCommentQueryResult = z.object({
username: z.string().min(1).max(50),
}),
});
export const BeerCommentQueryResultArray = z.array(BeerCommentQueryResult);
export type BeerCommentQueryResultT = z.infer<typeof BeerCommentQueryResult>;
export type BeerCommentQueryResultArrayT = z.infer<typeof BeerCommentQueryResultArray>;
export default BeerCommentQueryResult;