Task: Define Shared Zod Schemas for All Core Models #341

Open
opened 2026-02-27 23:57:26 +00:00 by jjalangtry · 0 comments
jjalangtry commented 2026-02-27 23:57:26 +00:00 (Migrated from github.com)

Define Shared Zod Schemas for All Core Models

Description

zod@^4.1.12 is already a declared dependency but is barely used in application code. Every API route validates manually with ad-hoc field presence checks, typeof guards, and one-off regexes. This task creates a central schema library so validation rules are defined once and reused across all routes.

Associated Epic: #340

Subtasks

  • Create directory next/lib/schemas/
  • user.schema.ts — name (max 100, letters/spaces/hyphens), email (valid format), bio (max 1000), gitHub URL (https only, max 500), linkedIn URL (https only, max 500), major (max 100), graduationYear (4-digit number), graduationTerm (enum)
  • event.schema.ts — title (max 200), description (max 2000), date (ISO datetime), location (max 300), attendanceEnabled (boolean)
  • quote.schema.ts — quote (max 2000, no bare HTML tags), author (max 100), dateAdded (ISO date), userId (positive integer)
  • golink.schema.ts — name (^[a-z0-9-]+$, max 60), url (https?:// scheme only via z.string().url() + refine)
  • mentor.schema.ts — bio (max 1000), skills array, availability fields
  • project.schema.ts — title (max 200), description (max 2000), leadid (positive integer), completed (boolean)
  • sponsor.schema.ts — name (max 200), description (max 1000), logoUrl (https only), websiteUrl (https only)
  • alumni.schema.ts — name (max 100), email (valid format), description (max 1000), linkedIn/gitHub URLs (https only)
  • announcement.schema.ts — message (max 500), category (max 100, optional), active (boolean)
  • purchasing.schema.ts — item (max 200), amount (positive number), vendor (max 200), justification (max 1000)
  • Export all schemas from next/lib/schemas/index.ts

Acceptance Criteria

  • All schema files exist under next/lib/schemas/
  • Each schema uses z.string().max(N) for every free-text field
  • URL fields reject non-http/https schemes
  • GoLink name field rejects uppercase, spaces, and special characters
  • Schemas export both the Zod schema and the inferred TypeScript type
# Define Shared Zod Schemas for All Core Models ## Description zod@^4.1.12 is already a declared dependency but is barely used in application code. Every API route validates manually with ad-hoc field presence checks, typeof guards, and one-off regexes. This task creates a central schema library so validation rules are defined once and reused across all routes. Associated Epic: #340 ## Subtasks - [ ] Create directory next/lib/schemas/ - [ ] user.schema.ts — name (max 100, letters/spaces/hyphens), email (valid format), bio (max 1000), gitHub URL (https only, max 500), linkedIn URL (https only, max 500), major (max 100), graduationYear (4-digit number), graduationTerm (enum) - [ ] event.schema.ts — title (max 200), description (max 2000), date (ISO datetime), location (max 300), attendanceEnabled (boolean) - [ ] quote.schema.ts — quote (max 2000, no bare HTML tags), author (max 100), dateAdded (ISO date), userId (positive integer) - [ ] golink.schema.ts — name (^[a-z0-9-]+$, max 60), url (https?:// scheme only via z.string().url() + refine) - [ ] mentor.schema.ts — bio (max 1000), skills array, availability fields - [ ] project.schema.ts — title (max 200), description (max 2000), leadid (positive integer), completed (boolean) - [ ] sponsor.schema.ts — name (max 200), description (max 1000), logoUrl (https only), websiteUrl (https only) - [ ] alumni.schema.ts — name (max 100), email (valid format), description (max 1000), linkedIn/gitHub URLs (https only) - [ ] announcement.schema.ts — message (max 500), category (max 100, optional), active (boolean) - [ ] purchasing.schema.ts — item (max 200), amount (positive number), vendor (max 200), justification (max 1000) - [ ] Export all schemas from next/lib/schemas/index.ts ## Acceptance Criteria - [ ] All schema files exist under next/lib/schemas/ - [ ] Each schema uses z.string().max(N) for every free-text field - [ ] URL fields reject non-http/https schemes - [ ] GoLink name field rejects uppercase, spaces, and special characters - [ ] Schemas export both the Zod schema and the inferred TypeScript type
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SSE/WebsiteTheSSEquel#341
No description provided.