fix(documents): gate selected_custom_fields behind editable guard; bound index cap to column width
Addresses review: add selected_custom_fields to offers/issued-orders NON_STATUS_UPDATE_FIELDS so a non-editable document rejects selection edits (status-only transitions still pass); tighten Zod cap 200->50 to stay within VARCHAR(255). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,7 @@ export const CreateInvoiceSchema = z.object({
|
||||
// Positional indices of company custom fields to print on this document's PDF.
|
||||
selected_custom_fields: z
|
||||
.array(z.number().int().nonnegative())
|
||||
.max(200)
|
||||
.max(50)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ export const UpdateInvoiceSchema = z.object({
|
||||
sections: z.array(DocumentSectionSchema).optional(),
|
||||
selected_custom_fields: z
|
||||
.array(z.number().int().nonnegative())
|
||||
.max(200)
|
||||
.max(50)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export const CreateIssuedOrderSchema = z.object({
|
||||
// PDF. Omitted/empty ⇒ none. Update schema derives via .partial().
|
||||
selected_custom_fields: z
|
||||
.array(z.number().int().nonnegative())
|
||||
.max(200)
|
||||
.max(50)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export const CreateQuotationSchema = z.object({
|
||||
// PDF. Omitted/empty ⇒ none. Update schema derives via .partial().
|
||||
selected_custom_fields: z
|
||||
.array(z.number().int().nonnegative())
|
||||
.max(200)
|
||||
.max(50)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ const NON_STATUS_UPDATE_FIELDS = [
|
||||
"language",
|
||||
"order_text",
|
||||
"internal_notes",
|
||||
"selected_custom_fields",
|
||||
"items",
|
||||
"sections",
|
||||
] as const;
|
||||
|
||||
@@ -68,6 +68,7 @@ const NON_STATUS_UPDATE_FIELDS = [
|
||||
"language",
|
||||
"scope_title",
|
||||
"scope_description",
|
||||
"selected_custom_fields",
|
||||
"items",
|
||||
"sections",
|
||||
] as const;
|
||||
|
||||
Reference in New Issue
Block a user