Skip to content
Snippets Groups Projects

Issue#10 ADD implant validators

Merged RICARDO PRADO FARIA requested to merge issue-10/implant-validator into develop
1 file
+ 7
6
Compare changes
  • Side-by-side
  • Inline
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
Loading