feat(documents): accept selected_custom_fields in document schemas

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-16 20:08:44 +02:00
parent 2f084174df
commit 2b3266a1cc
3 changed files with 21 additions and 0 deletions

View File

@@ -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<typeof CreateInvoiceSchema>;

View File

@@ -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

View File

@@ -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