Files
accounted/lib/pending-operations/schemas/voucher-note.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

20 lines
914 B
TypeScript

import { z } from 'zod'
// Commit-boundary re-validation for the staged set_voucher_note operation
// (gnubok_set_voucher_note). Notes are annotation metadata alongside the
// verifikat, not räkenskapsinformation: the journal_entries immutability
// trigger (migration 20260608120000) allows a notes-only UPDATE on committed
// entries and rejects anything that touches a bookkeeping field, so this
// schema only has to bound the shape. Max length matches the dashboard
// PATCH route (app/api/bookkeeping/journal-entries/[id]/notes/route.ts).
export const SetVoucherNoteParamsSchema = z.object({
journal_entry_id: z.string().uuid(),
// null clears the note; empty/whitespace-only strings are normalised to
// null so the column never stores visually-empty annotations.
notes: z.preprocess(
(v) => (typeof v === 'string' && v.trim() === '' ? null : v),
z.string().max(2000).nullable(),
),
})