2026-04-20 17:20:42 +00:00
|
|
|
import {
|
|
|
|
|
CountryCodeSchema,
|
|
|
|
|
EmailSchema,
|
|
|
|
|
LandPhoneSchema,
|
|
|
|
|
MobilePhoneSchema,
|
|
|
|
|
PostalCodeSchema,
|
|
|
|
|
TinSchema,
|
|
|
|
|
URLSchema,
|
|
|
|
|
} from "@erp/core";
|
2025-09-24 17:30:35 +00:00
|
|
|
import { z } from "zod/v4";
|
2025-09-01 14:07:59 +00:00
|
|
|
|
2025-09-02 10:55:45 +00:00
|
|
|
export const UpdateCustomerByIdParamsRequestSchema = z.object({
|
2026-04-20 17:20:42 +00:00
|
|
|
customer_id: z.uuid(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type UpdateCustomerByIdParamsRequestDTO = z.infer<
|
|
|
|
|
typeof UpdateCustomerByIdParamsRequestSchema
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export const UpdateCustomerAddressPatchRequestSchema = z.object({
|
|
|
|
|
street: z.string().nullable().optional(),
|
|
|
|
|
street2: z.string().nullable().optional(),
|
|
|
|
|
city: z.string().nullable().optional(),
|
|
|
|
|
province: z.string().nullable().optional(),
|
|
|
|
|
postal_code: PostalCodeSchema.nullable().optional(),
|
|
|
|
|
country: CountryCodeSchema.nullable().optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const UpdateCustomerContactPatchRequestSchema = z.object({
|
|
|
|
|
email_primary: EmailSchema.nullable().optional(),
|
|
|
|
|
email_secondary: EmailSchema.nullable().optional(),
|
|
|
|
|
phone_primary: LandPhoneSchema.nullable().optional(),
|
|
|
|
|
phone_secondary: LandPhoneSchema.nullable().optional(),
|
|
|
|
|
mobile_primary: MobilePhoneSchema.nullable().optional(),
|
|
|
|
|
mobile_secondary: MobilePhoneSchema.nullable().optional(),
|
|
|
|
|
fax: LandPhoneSchema.nullable().optional(),
|
|
|
|
|
website: URLSchema.nullable().optional(),
|
2025-09-02 08:57:41 +00:00
|
|
|
});
|
|
|
|
|
|
2025-09-02 10:55:45 +00:00
|
|
|
export const UpdateCustomerByIdRequestSchema = z.object({
|
2026-04-20 17:20:42 +00:00
|
|
|
reference: z.string().nullable().optional(),
|
2025-09-01 14:07:59 +00:00
|
|
|
|
2026-04-20 17:20:42 +00:00
|
|
|
is_company: z.boolean().optional(),
|
2025-09-01 14:07:59 +00:00
|
|
|
name: z.string().optional(),
|
2026-04-20 17:20:42 +00:00
|
|
|
trade_name: z.string().nullable().optional(),
|
|
|
|
|
tin: TinSchema.nullable().optional(),
|
2025-09-01 14:07:59 +00:00
|
|
|
|
2026-04-20 17:20:42 +00:00
|
|
|
default_taxes: z.string().nullable().optional(),
|
2025-09-21 19:19:58 +00:00
|
|
|
|
2026-04-20 17:20:42 +00:00
|
|
|
address: UpdateCustomerAddressPatchRequestSchema.optional(),
|
|
|
|
|
contact: UpdateCustomerContactPatchRequestSchema.optional(),
|
2025-09-01 14:07:59 +00:00
|
|
|
|
2026-04-20 17:20:42 +00:00
|
|
|
legal_record: z.string().nullable().optional(),
|
2025-09-01 14:07:59 +00:00
|
|
|
|
|
|
|
|
language_code: z.string().optional(),
|
|
|
|
|
currency_code: z.string().optional(),
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-20 17:20:42 +00:00
|
|
|
export type UpdateCustomerAddressPatchRequestDTO = z.infer<
|
|
|
|
|
typeof UpdateCustomerAddressPatchRequestSchema
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export type UpdateCustomerContactPatchRequestDTO = z.infer<
|
|
|
|
|
typeof UpdateCustomerContactPatchRequestSchema
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export type UpdateCustomerByIdRequestDTO = z.infer<typeof UpdateCustomerByIdRequestSchema>;
|