diff --git a/src/validators/implantsValidator.ts b/src/validators/implantsValidator.ts index 70551fca9ee9201ecb5bd256d985257ee9ffec82..ee1af3aca7e36b4452d58e5013444444ac0d3e72 100644 --- a/src/validators/implantsValidator.ts +++ b/src/validators/implantsValidator.ts @@ -1,9 +1,10 @@ import { z } from 'zod'; export const implantSchema = z.object({ - id: z.number().int().optional(), - name: z.string().min(1, "Name cannot be empty"), - price: z.number().nonnegative(), - cyberCost: z.number().nonnegative(), - bodyPart: z.string().min(1, "Must be part of something"), -}); \ No newline at end of file + name: z.string().min(1, { message: "Name cannot be empty" }).max(255, { message: "Max of 255 characters" }), + price: z.number().nonnegative({ message: "Price must be positive" }).finite({ message: "Price must be a valid number" }), + cyberCost: z.number().nonnegative({ message: "cyberCost must be positive" }).finite({ message: "cyberCost must be a valid number" }), + bodyPart: z.string().min(1, { message: "Bodypart must be named" }).max(255, { message: "Bodypart cant have more than 255 characters" }), +}); + +export const updateImplantSchema = implantSchema.partial(); \ No newline at end of file