Files
HealthLog/src/lib/validations/invite.ts
T
Marc-André Bombeck 1f4ba5939d style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean
baseline. Formatting only — no behaviour change. Generator-owned and
vendored artifacts stay untouched via .prettierignore.
2026-06-19 22:20:31 +02:00

27 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* v1.15.20 — request schema for `POST /api/admin/invites`.
*
* Lives outside the route file (and outside the Prisma-backed helper
* `src/lib/auth/invite-token.ts`) so the OpenAPI registry can import it
* without dragging `@/lib/db` into the generator script — the same
* split as `src/lib/validations/about-me.ts`.
*/
import { z } from "zod/v4";
/** Hard ceiling on the admin-selectable invite lifetime (days). */
export const INVITE_MAX_TTL_DAYS = 30;
/** Hard ceiling on multi-use invites — generous for a household / small
* practice, far below anything that would re-open registration at scale. */
export const INVITE_MAX_USES_CAP = 50;
export const inviteCreateSchema = z.object({
/** Lifetime in days. The admin UI offers 7 / 14 / 30; the API accepts
* any integer 1–30 so an operator can script shorter invites. */
expiresInDays: z.number().int().min(1).max(INVITE_MAX_TTL_DAYS).default(7),
/** How many signups this invite admits. Default: single-use. */
maxUses: z.number().int().min(1).max(INVITE_MAX_USES_CAP).default(1),
});
export type InviteCreateInput = z.infer<typeof inviteCreateSchema>;