paperclip/packages/shared/src/validators/project.ts

22 lines
817 B
TypeScript
Raw Normal View History

import { z } from "zod";
import { PROJECT_STATUSES } from "../constants.js";
export const createProjectSchema = z.object({
/** @deprecated Use goalIds instead */
goalId: z.string().uuid().optional().nullable(),
goalIds: z.array(z.string().uuid()).optional(),
name: z.string().min(1),
description: z.string().optional().nullable(),
status: z.enum(PROJECT_STATUSES).optional().default("backlog"),
leadAgentId: z.string().uuid().optional().nullable(),
targetDate: z.string().optional().nullable(),
color: z.string().optional().nullable(),
archivedAt: z.string().datetime().optional().nullable(),
});
export type CreateProject = z.infer<typeof createProjectSchema>;
export const updateProjectSchema = createProjectSchema.partial();
export type UpdateProject = z.infer<typeof updateProjectSchema>;