srs-api/src/routes/api/schemas.ts
Aswin Biju 61514fb82f
All checks were successful
deploy / test (push) Successful in 1m33s
deploy / deploy (push) Successful in 18s
feat(users): added a wizard to reset a password and supporting services for the srs PWA
2026-11-04 20:44:36 +05:30

11 lines
530 B
TypeScript

import { z } from 'zod';
import { isRealDate } from '../../services/dateMath';
export const isoDate = z.string().refine(isRealDate, 'Enter a valid date such as 2026-11-04.');
export const monthText = z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/, 'Enter a month such as 2026-11.');
export const idParam = z.coerce.number().int().positive();
export const endingParam = z.string().regex(/^\d{4}$/, 'An ending is four digits.');
export const idParams = z.object({ id: idParam });
export const dateQuery = z.object({ date: isoDate });