Skip to content
Snippets Groups Projects
Commit 5149373c authored by Ricardo's avatar Ricardo
Browse files

Issue#10 ADD implant validators

parent e9560890
No related branches found
No related tags found
1 merge request!13Issue#10 ADD implant validators
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment