Uecko_ERP/modules/customer-invoices/src/common/dto/response/get-customer-invoice-by-id.response.dto.ts

82 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-09-12 16:23:36 +00:00
import { MetadataSchema, MoneySchema, PercentageSchema, QuantitySchema } from "@erp/core";
2025-09-24 17:30:35 +00:00
import { z } from "zod/v4";
2025-06-26 11:32:55 +00:00
2025-08-12 11:23:50 +00:00
export const GetCustomerInvoiceByIdResponseSchema = z.object({
2025-06-26 11:32:55 +00:00
id: z.uuid(),
2025-09-03 18:04:09 +00:00
company_id: z.uuid(),
2025-06-26 11:32:55 +00:00
invoice_number: z.string(),
2025-09-03 18:04:09 +00:00
status: z.string(),
series: z.string(),
2025-09-04 17:57:04 +00:00
invoice_date: z.string(),
2025-09-03 18:04:09 +00:00
operation_date: z.string(),
2025-10-03 19:01:38 +00:00
description: z.string(),
2025-09-03 18:04:09 +00:00
notes: z.string(),
2025-06-26 11:32:55 +00:00
language_code: z.string(),
2025-09-03 18:04:09 +00:00
currency_code: z.string(),
2025-09-17 17:37:41 +00:00
customer_id: z.string(),
recipient: z.object({
id: z.string(),
name: z.string(),
tin: z.string(),
street: z.string(),
street2: z.string(),
city: z.string(),
province: z.string(),
postal_code: z.string(),
country: z.string(),
}),
2025-09-29 07:32:13 +00:00
taxes: z.array(
z.object({
tax_code: z.string(),
taxable_amount: MoneySchema,
taxes_amount: MoneySchema,
})
),
2025-09-11 15:14:51 +00:00
2025-09-22 17:43:55 +00:00
payment_method: z
.object({
payment_id: z.string(),
payment_description: z.string(),
})
.optional(),
2025-09-12 16:23:36 +00:00
subtotal_amount: MoneySchema,
2025-09-04 10:02:24 +00:00
discount_percentage: PercentageSchema,
2025-09-12 16:23:36 +00:00
discount_amount: MoneySchema,
taxable_amount: MoneySchema,
taxes_amount: MoneySchema,
total_amount: MoneySchema,
2025-09-04 10:02:24 +00:00
2025-09-03 18:04:09 +00:00
items: z.array(
z.object({
2025-09-04 10:02:24 +00:00
id: z.uuid(),
2025-09-19 09:29:49 +00:00
isNonValued: z.string(),
2025-09-03 18:04:09 +00:00
position: z.string(),
description: z.string(),
quantity: QuantitySchema,
2025-09-12 16:23:36 +00:00
unit_amount: MoneySchema,
2025-09-29 18:22:59 +00:00
tax_codes: z.array(z.string()),
2025-09-12 16:23:36 +00:00
subtotal_amount: MoneySchema,
discount_percentage: PercentageSchema,
discount_amount: MoneySchema,
taxable_amount: MoneySchema,
taxes_amount: MoneySchema,
total_amount: MoneySchema,
2025-09-03 18:04:09 +00:00
})
),
2025-06-26 11:32:55 +00:00
metadata: MetadataSchema.optional(),
});
2025-08-12 11:23:50 +00:00
export type GetCustomerInvoiceByIdResponseDTO = z.infer<
typeof GetCustomerInvoiceByIdResponseSchema
2025-06-26 11:32:55 +00:00
>;