info vendedor + direccion del producto
This commit is contained in:
@@ -6,18 +6,25 @@ export type InventoryTable = z.infer<typeof product>;
|
||||
export type EditInventory = z.infer<typeof editInventory>; //output
|
||||
export type formDataInput = z.input<typeof editInventory>;
|
||||
export type ProductApiResponseSchema = z.infer<typeof productApiResponseSchema>;
|
||||
export type allProducts = z.infer<typeof allProducts>;
|
||||
export type allProducts = z.infer<typeof productDetails>;
|
||||
|
||||
export const product = z.object({
|
||||
id: z.number().optional(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
address: z.string(),
|
||||
// category: z.string(),
|
||||
stock: z.number(),
|
||||
price: z.string(),
|
||||
urlImg: z.string(),
|
||||
userId: z.number().optional()
|
||||
});
|
||||
})
|
||||
|
||||
export const productDetails = product.extend({
|
||||
fullname: z.string(),
|
||||
phone: z.string().nullable(),
|
||||
email: z.string().email().nullable()
|
||||
})
|
||||
|
||||
export const editInventory = z.object({
|
||||
id: z.number().optional(),
|
||||
@@ -31,16 +38,16 @@ export const editInventory = z.object({
|
||||
userId: z.number().optional(),
|
||||
})
|
||||
|
||||
export const allProducts = z.object({
|
||||
id: z.number().optional(),
|
||||
title: z.string().min(5, { message: "Debe de tener 5 o más caracteres" }),
|
||||
description: z.string().min(10, { message: "Debe de tener 10 o más caracteres" }),
|
||||
stock: z.number(),
|
||||
price: z.string(),
|
||||
urlImg: z.string(),
|
||||
userId: z.number(),
|
||||
fullname: z.string()
|
||||
})
|
||||
// export const productDetails = z.object({
|
||||
// id: z.number().optional(),
|
||||
// title: z.string().min(5),
|
||||
// description: z.string().min(10),
|
||||
// stock: z.number(),
|
||||
// price: z.string(),
|
||||
// address: z.string(),
|
||||
// urlImg: z.string(),
|
||||
// userId: z.number(),
|
||||
// })
|
||||
|
||||
export const ApiResponseSchema = z.object({
|
||||
message: z.string(),
|
||||
@@ -59,7 +66,7 @@ export const ApiResponseSchema = z.object({
|
||||
|
||||
export const productApiResponseSchema = z.object({
|
||||
message: z.string(),
|
||||
data: z.array(allProducts),
|
||||
data: z.array(productDetails),
|
||||
meta: z.object({
|
||||
page: z.number(),
|
||||
limit: z.number(),
|
||||
@@ -79,5 +86,5 @@ export const productMutate = z.object({
|
||||
|
||||
export const getProduct = z.object({
|
||||
message: z.string(),
|
||||
data: allProducts,
|
||||
data: productDetails,
|
||||
})
|
||||
Reference in New Issue
Block a user