FactuGES_ERP/modules/customers/src/common/dto/response/get-customer-by-id.response.dto.ts
2026-04-24 20:53:05 +02:00

61 lines
1.5 KiB
TypeScript

import {
CountryCodeSchema,
CurrencyCodeSchema,
EmailSchema,
LandPhoneSchema,
LanguageCodeSchema,
MetadataSchema,
MobilePhoneSchema,
PostalCodeSchema,
TinSchema,
URLSchema,
} from "@erp/core";
import { z } from "zod/v4";
import { TaxCombinationCodeSchema } from "../shared";
import { CustomerStatusSchema } from "../shared/customer-status.dto";
export const GetCustomerByIdResponseSchema = z.object({
id: z.uuid(),
company_id: z.uuid(),
status: CustomerStatusSchema,
reference: z.string().nullable(),
is_company: z.boolean(),
name: z.string(),
trade_name: z.string().nullable(),
tin: TinSchema.nullable(),
address: z.object({
street: z.string().nullable(),
street2: z.string().nullable(),
city: z.string().nullable(),
province: z.string().nullable(),
postal_code: PostalCodeSchema.nullable(),
country: CountryCodeSchema.nullable(),
}),
contact: z.object({
email_primary: EmailSchema.nullable(),
email_secondary: EmailSchema.nullable(),
phone_primary: LandPhoneSchema.nullable(),
phone_secondary: LandPhoneSchema.nullable(),
mobile_primary: MobilePhoneSchema.nullable(),
mobile_secondary: MobilePhoneSchema.nullable(),
fax: LandPhoneSchema.nullable(),
website: URLSchema.nullable(),
}),
legal_record: z.string().nullable(),
default_taxes: TaxCombinationCodeSchema,
language_code: LanguageCodeSchema,
currency_code: CurrencyCodeSchema,
metadata: MetadataSchema.optional(),
});
export type GetCustomerByIdResponseDTO = z.infer<typeof GetCustomerByIdResponseSchema>;