FactuGES_ERP/modules/customers/src/common/dto/response/get-customer-by-id.response.dto.ts

61 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-04-20 17:20:42 +00:00
import {
CountryCodeSchema,
CurrencyCodeSchema,
EmailSchema,
LandPhoneSchema,
LanguageCodeSchema,
MetadataSchema,
MobilePhoneSchema,
PostalCodeSchema,
TinSchema,
URLSchema,
} from "@erp/core";
2025-09-24 17:30:35 +00:00
import { z } from "zod/v4";
2025-08-11 17:49:52 +00:00
2026-04-24 18:53:05 +00:00
import { TaxCombinationCodeSchema } from "../shared";
2026-04-20 17:20:42 +00:00
import { CustomerStatusSchema } from "../shared/customer-status.dto";
2025-08-12 11:23:50 +00:00
export const GetCustomerByIdResponseSchema = z.object({
2025-08-11 17:49:52 +00:00
id: z.uuid(),
2025-09-01 14:07:59 +00:00
company_id: z.uuid(),
2026-04-20 17:20:42 +00:00
status: CustomerStatusSchema,
reference: z.string().nullable(),
2025-08-21 08:14:12 +00:00
2026-04-20 17:20:42 +00:00
is_company: z.boolean(),
2025-08-21 08:14:12 +00:00
name: z.string(),
2026-04-20 17:20:42 +00:00
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(),
2026-04-24 18:53:05 +00:00
default_taxes: TaxCombinationCodeSchema,
2026-04-20 17:20:42 +00:00
language_code: LanguageCodeSchema,
currency_code: CurrencyCodeSchema,
2025-08-11 17:49:52 +00:00
metadata: MetadataSchema.optional(),
});
2025-08-12 11:23:50 +00:00
export type GetCustomerByIdResponseDTO = z.infer<typeof GetCustomerByIdResponseSchema>;