Zod validation schemas for creating, updating, sorting, and filtering activities with priority and timeline constraints. Reuse for CRM activity management backends.
// Source: https://github.com/sneg55/warpdrive | License: MIT | Copyright 2026 Nikita Sawinyh
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";
import { ACTIVITY_PRIORITY_KEYS } from "@/constants/activityPriorities";
export const activityCreateInput = z
.object({
typeId: z.string().uuid(),
subject: z.string().min(1).max(255),
priority: z
.enum(ACTIVITY_PRIORITY_KEYS as [string, ...string[]])
.nullable()
.default(null),
dueAt: z.string().datetime().nullable().default(null),
// True when the user gave a day but no time. See composeDueAt.
allDay: z.boolean().default(false),
// Multi-day end timestamp (Pipedrive parity). Ordering vs dueAt is enforced in the repo.
endAt: z.string().datetime().nullable()
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key