dow-prod-tracker/src/lib/validators/project.ts
Leivur R. Djurhuus 2859a50761 Add Project CRUD: API routes, service layer, form, and list page
- Zod validation schemas for create/update project
- Service layer with listProjects, getProject, createProject,
  updateProject, deleteProject
- API routes: GET/POST /api/projects, GET/PATCH/DELETE /api/projects/:id
- TanStack Query hooks for all project operations
- Project list page with card grid, status/priority badges
- Project create dialog with form validation
- QueryProvider + API utility helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:11:46 -06:00

19 lines
715 B
TypeScript

import { z } from "zod/v4";
export const createProjectSchema = z.object({
projectCode: z
.string()
.min(1, "Project code is required")
.max(50, "Project code must be 50 characters or less"),
name: z.string().min(1, "Name is required").max(200),
description: z.string().max(2000).optional(),
status: z.enum(["ACTIVE", "ON_HOLD", "COMPLETED", "ARCHIVED"]),
priority: z.enum(["LOW", "MEDIUM", "HIGH", "URGENT"]),
startDate: z.string().optional(),
dueDate: z.string().optional(),
});
export const updateProjectSchema = createProjectSchema.partial();
export type CreateProjectInput = z.infer<typeof createProjectSchema>;
export type UpdateProjectInput = z.infer<typeof updateProjectSchema>;