Uecko_ERP/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts
2026-06-15 20:27:11 +02:00

74 lines
2.3 KiB
TypeScript

import {
CountryCodeSchema,
CurrencyCodeSchema,
EmailSchema,
LandPhoneSchema,
LanguageCodeSchema,
MobilePhoneSchema,
PostalCodeSchema,
TinSchema,
URLSchema,
} from "@erp/core";
import { z } from "zod/v4";
export const UpdateCustomerByIdParamsRequestSchema = z.object({
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(),
});
export const UpdateCustomerByIdRequestSchema = z.object({
reference: z.string().nullable().optional(),
is_company: z.boolean().optional(),
name: z.string().optional(),
trade_name: z.string().nullable().optional(),
tin: TinSchema.nullable().optional(),
payment_method_id: z.uuid().nullable().optional(),
payment_term_id: z.uuid().nullable().optional(),
tax_regime_code: z.string().nullable().optional(),
uses_equivalence_surcharge: z.boolean().optional(),
uses_retention: z.boolean().optional(),
address: UpdateCustomerAddressPatchRequestSchema.optional(),
contact: UpdateCustomerContactPatchRequestSchema.optional(),
legal_record: z.string().nullable().optional(),
language_code: LanguageCodeSchema.optional(),
currency_code: CurrencyCodeSchema.optional(),
});
export type UpdateCustomerAddressPatchRequestDTO = z.infer<
typeof UpdateCustomerAddressPatchRequestSchema
>;
export type UpdateCustomerContactPatchRequestDTO = z.infer<
typeof UpdateCustomerContactPatchRequestSchema
>;
export type UpdateCustomerByIdRequestDTO = z.infer<typeof UpdateCustomerByIdRequestSchema>;