2025-09-24 17:30:35 +00:00
|
|
|
import { z } from "zod/v4";
|
2025-09-24 10:34:04 +00:00
|
|
|
|
2025-09-30 15:58:04 +00:00
|
|
|
import { ArrayElement } from "@repo/rdx-utils";
|
2025-09-24 10:34:04 +00:00
|
|
|
import {
|
|
|
|
|
CreateCustomerRequestSchema,
|
|
|
|
|
GetCustomerByIdResponseSchema,
|
2025-09-24 15:09:37 +00:00
|
|
|
ListCustomersResponseDTO,
|
2025-09-24 10:34:04 +00:00
|
|
|
UpdateCustomerByIdRequestSchema,
|
2025-09-29 18:22:59 +00:00
|
|
|
} from "../../common";
|
2025-09-22 17:43:55 +00:00
|
|
|
|
2025-09-30 15:58:04 +00:00
|
|
|
// Esquemas (Zod) provenientes del servidor
|
|
|
|
|
export const CustomerSchema = GetCustomerByIdResponseSchema.omit({ metadata: true });
|
2025-09-22 17:43:55 +00:00
|
|
|
export const CustomerCreateSchema = CreateCustomerRequestSchema;
|
|
|
|
|
export const CustomerUpdateSchema = UpdateCustomerByIdRequestSchema;
|
2025-09-24 10:34:04 +00:00
|
|
|
|
2025-09-30 15:58:04 +00:00
|
|
|
// Tipos (derivados de Zod o DTOs del backend)
|
|
|
|
|
export type Customer = z.infer<typeof CustomerSchema>; // Entidad completa (GET/POST/PUT result)
|
|
|
|
|
export type CustomerCreateInput = z.infer<typeof CustomerCreateSchema>; // Cuerpo para crear
|
|
|
|
|
export type CustomerUpdateInput = z.infer<typeof CustomerUpdateSchema>; // Cuerpo para actualizar
|
2025-09-24 15:09:37 +00:00
|
|
|
|
2025-09-30 15:58:04 +00:00
|
|
|
// Resultado de consulta con criteria (paginado, etc.)
|
|
|
|
|
export type CustomersPage = ListCustomersResponseDTO;
|
|
|
|
|
|
|
|
|
|
// Ítem simplificado dentro del listado (no toda la entidad)
|
2025-09-30 17:03:20 +00:00
|
|
|
export type CustomerSummary = Omit<ArrayElement<CustomersPage["items"]>, "metadata">;
|