Files
hackerspace.sh/lib/validations/dues.ts
T
Moheeb ZaraandClaude Opus 4.8 18d5e22ad4 refactor(validations): split lib/validations.ts into a barrel'd folder (slice 1)
1141-line lib/validations.ts → lib/validations/<feature>.ts + primitives.ts +
an index.ts barrel. '@/lib/validations' now resolves to the barrel, so all 40
importers are untouched. Every one of the 143 exports is preserved verbatim
(verified by symbol-diff); schemas moved unchanged. tsc 0, 635 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-02 04:19:11 -07:00

19 lines
827 B
TypeScript

import { z } from 'zod'
import { DUES_LINK_PLATFORMS, isSafeDuesUrl } from '../dues-payments-logic'
// One external pay-here URL per platform. url must be absolute https (no
// http downgrade, no javascript:/data: scheme) since it is rendered as a
// member-clickable anchor. instructions is an optional memo hint (e.g. "put
// your member name in the note") to help the treasurer reconcile later.
export const duesPaymentMethodSchema = z.object({
platform: z.enum(DUES_LINK_PLATFORMS as unknown as [string, ...string[]]),
url: z
.string()
.trim()
.max(500)
.refine(isSafeDuesUrl, 'Enter an absolute https:// URL'),
instructions: z.string().trim().max(300).optional().nullable(),
is_active: z.boolean().optional().default(true),
sort_order: z.number().int().min(0).max(999).optional().default(0),
})