Vista (intefaz y bd), esquema y endpoints de store agregados
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import { user } from '@/feactures/auth/schemas/register';
|
||||
import { all } from 'axios';
|
||||
import { z } from 'zod';
|
||||
|
||||
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 const product = z.object({
|
||||
id: z.number().optional(),
|
||||
@@ -27,6 +31,18 @@ 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(),
|
||||
user: z.object({
|
||||
userId: z.number(),
|
||||
username: z.string(),
|
||||
})
|
||||
})
|
||||
|
||||
export const ApiResponseSchema = z.object({
|
||||
message: z.string(),
|
||||
@@ -43,6 +59,21 @@ export const ApiResponseSchema = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
export const productApiResponseSchema = z.object({
|
||||
message: z.string(),
|
||||
data: z.array(allProducts),
|
||||
meta: z.object({
|
||||
page: z.number(),
|
||||
limit: z.number(),
|
||||
totalCount: z.number(),
|
||||
totalPages: z.number(),
|
||||
hasNextPage: z.boolean(),
|
||||
hasPreviousPage: z.boolean(),
|
||||
nextPage: z.number().nullable(),
|
||||
previousPage: z.number().nullable(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const productMutate = z.object({
|
||||
message: z.string(),
|
||||
data: product,
|
||||
|
||||
Reference in New Issue
Block a user