diff --git a/src/schemas/invoices.schema.ts b/src/schemas/invoices.schema.ts index 69c01b3..b6ae94f 100644 --- a/src/schemas/invoices.schema.ts +++ b/src/schemas/invoices.schema.ts @@ -50,6 +50,11 @@ export const CreateInvoiceSchema = z.object({ // Rich-text CZ/EN "Obsah" sections rendered after the items on the PDF // (mirrors issued orders — shared DocumentSectionSchema, DB-aligned limits). sections: z.array(DocumentSectionSchema).optional(), + // Positional indices of company custom fields to print on this document's PDF. + selected_custom_fields: z + .array(z.number().int().nonnegative()) + .max(200) + .optional(), }); export const UpdateInvoiceSchema = z.object({ @@ -74,6 +79,10 @@ export const UpdateInvoiceSchema = z.object({ paid_date: nullableIsoDateString, items: z.array(InvoiceItemSchema).optional(), sections: z.array(DocumentSectionSchema).optional(), + selected_custom_fields: z + .array(z.number().int().nonnegative()) + .max(200) + .optional(), }); export type CreateInvoiceInput = z.infer; diff --git a/src/schemas/issued-orders.schema.ts b/src/schemas/issued-orders.schema.ts index e628764..f570c47 100644 --- a/src/schemas/issued-orders.schema.ts +++ b/src/schemas/issued-orders.schema.ts @@ -41,6 +41,12 @@ export const CreateIssuedOrderSchema = z.object({ // Rich-text CZ/EN sections rendered on their own PDF page (mirrors offers' // scope_sections — shared DocumentSectionSchema, DB-aligned limits). sections: z.array(DocumentSectionSchema).optional(), + // Positional indices of company custom fields to print on this document's + // PDF. Omitted/empty ⇒ none. Update schema derives via .partial(). + selected_custom_fields: z + .array(z.number().int().nonnegative()) + .max(200) + .optional(), }); // Update = partial create MINUS the number: PO numbers are immutable diff --git a/src/schemas/offers.schema.ts b/src/schemas/offers.schema.ts index 4fec4d9..5a52677 100644 --- a/src/schemas/offers.schema.ts +++ b/src/schemas/offers.schema.ts @@ -48,6 +48,12 @@ export const CreateQuotationSchema = z.object({ scope_description: z.string().max(8000).nullish(), items: z.array(QuotationItemSchema).optional(), sections: z.array(ScopeSectionSchema).optional(), + // Positional indices of company custom fields to print on this document's + // PDF. Omitted/empty ⇒ none. Update schema derives via .partial(). + selected_custom_fields: z + .array(z.number().int().nonnegative()) + .max(200) + .optional(), }); // Update = partial create MINUS the number: quotation numbers are immutable