Uecko_ERP/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts

74 lines
2.3 KiB
TypeScript
Raw Normal View History

2026-04-20 17:20:42 +00:00
import {
CountryCodeSchema,
2026-04-24 18:53:05 +00:00
CurrencyCodeSchema,
2026-04-20 17:20:42 +00:00
EmailSchema,
LandPhoneSchema,
2026-04-24 18:53:05 +00:00
LanguageCodeSchema,
2026-04-20 17:20:42 +00:00
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-06-15 18:27:11 +00:00
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(),
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
2026-04-24 18:53:05 +00:00
language_code: LanguageCodeSchema.optional(),
currency_code: CurrencyCodeSchema.optional(),
2025-09-01 14:07:59 +00:00
});
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>;