Last active
November 16, 2024 20:39
-
-
Save codigoconjuan/0be4f11d1a77b211f764a0dd16845a65 to your computer and use it in GitHub Desktop.
Schema de Validación para Productos en Next.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const ProductFormSchema = z.object({ | |
name: z.string() | |
.min(1, {message: 'El Nombre del Producto no puede ir vacio'}), | |
price: z.coerce.number({message: 'Precio no válido'}) | |
.min(1, {message: 'El Precio debe ser mayor a 0'}), | |
inventory: z.coerce.number({message: 'Inventario no válido'}) | |
.min(1, {message: 'El inventario debe ser mayor a 0'}), | |
categoryId: z.coerce.number({message: 'La Categoria no es válida'}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment