mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-17 09:47:23 +00:00
Move next js project to archive (#207)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import ImageQueryValidationSchema from '@/services/schema/ImageSchema/ImageQueryValidationSchema';
|
||||
import { z } from 'zod';
|
||||
|
||||
const BeerPostQueryResult = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
brewery: z.object({ id: z.string(), name: z.string() }),
|
||||
description: z.string(),
|
||||
beerImages: z.array(ImageQueryValidationSchema),
|
||||
ibu: z.number(),
|
||||
abv: z.number(),
|
||||
style: z.object({ id: z.string(), name: z.string(), description: z.string() }),
|
||||
postedBy: z.object({ id: z.string(), username: z.string() }),
|
||||
createdAt: z.coerce.date(),
|
||||
updatedAt: z.coerce.date().nullable(),
|
||||
});
|
||||
|
||||
export default BeerPostQueryResult;
|
||||
@@ -0,0 +1,43 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const CreateBeerPostValidationSchema = z.object({
|
||||
name: z
|
||||
.string({
|
||||
required_error: 'Beer name is required.',
|
||||
invalid_type_error: 'Beer name must be a string.',
|
||||
})
|
||||
.min(1, { message: 'Beer name is required.' })
|
||||
.max(100, { message: 'Beer name is too long.' }),
|
||||
description: z
|
||||
.string()
|
||||
.min(1, { message: 'Description is required.' })
|
||||
.max(500, { message: 'Description is too long.' }),
|
||||
abv: z
|
||||
.number({
|
||||
required_error: 'ABV is required.',
|
||||
invalid_type_error: 'ABV must be a number.',
|
||||
})
|
||||
.min(0.1, { message: 'ABV must be greater than 0.1.' })
|
||||
.max(50, { message: 'ABV must be less than 50.' }),
|
||||
ibu: z
|
||||
.number({
|
||||
required_error: 'IBU is required.',
|
||||
invalid_type_error: 'IBU must be a number.',
|
||||
})
|
||||
.min(2, { message: 'IBU must be greater than 2.' })
|
||||
.max(100, { message: 'IBU must be less than 100.' }),
|
||||
styleId: z
|
||||
.string({
|
||||
required_error: 'Style id is required.',
|
||||
invalid_type_error: 'Style id must be a string.',
|
||||
})
|
||||
.cuid({ message: 'Invalid type id.' }),
|
||||
breweryId: z
|
||||
.string({
|
||||
required_error: 'Brewery id is required.',
|
||||
invalid_type_error: 'Brewery id must be a string.',
|
||||
})
|
||||
.cuid({ message: 'Invalid brewery id.' }),
|
||||
});
|
||||
|
||||
export default CreateBeerPostValidationSchema;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import CreateBeerPostValidationSchema from './CreateBeerPostValidationSchema';
|
||||
|
||||
const EditBeerPostValidationSchema = CreateBeerPostValidationSchema.omit({
|
||||
breweryId: true,
|
||||
styleId: true,
|
||||
}).extend({ id: z.string().cuid() });
|
||||
|
||||
export default EditBeerPostValidationSchema;
|
||||
Reference in New Issue
Block a user