big boi refactor to customer inof from passenger info

This commit is contained in:
user
2025-10-20 21:46:26 +03:00
parent 2cc0ca4c51
commit 2fdb934ec9
53 changed files with 702 additions and 2068 deletions

View File

@@ -0,0 +1,46 @@
import { z } from "zod";
export const customerInfoModel = z.object({
id: z.number().optional(),
firstName: z.string().min(1).max(64),
middleName: z.string().max(64).default(""),
lastName: z.string().min(1).max(64),
email: z.string().email().max(128),
phoneCountryCode: z.string().min(1).max(6),
phoneNumber: z.string().min(1).max(20),
country: z.string().min(1).max(128),
state: z.string().min(1).max(128),
city: z.string().min(1).max(128),
zipCode: z.string().min(1).max(21),
address: z.string().min(1),
address2: z.string().optional().nullable(),
orderId: z.number().optional().nullable(),
createdAt: z.coerce.string().optional(),
updatedAt: z.coerce.string().optional(),
});
export type CustomerInfoModel = z.infer<typeof customerInfoModel>;
export const createCustomerInfoPayload = customerInfoModel.omit({
id: true,
createdAt: true,
updatedAt: true,
});
export type CreateCustomerInfoPayload = z.infer<
typeof createCustomerInfoPayload
>;
export const updateCustomerInfoPayload = customerInfoModel
.omit({
createdAt: true,
updatedAt: true,
})
.partial()
.extend({
id: z.number(),
});
export type UpdateCustomerInfoPayload = z.infer<
typeof updateCustomerInfoPayload
>;