feat(codes): generateNextTaskCode + CODE_REGEX export + Zod regex op alle 3 schemas
- lib/code.ts: rename VALID_CODE_RE naar geexporteerde CODE_REGEX, verwijder ongebruikte deriveTaskCode - lib/code-server.ts: generateNextTaskCode(productId) — flat per-product T-N teller, hergebruikt nextSequential helper. Export isCodeUniqueConflict zodat callers P2002 op code-veld kunnen detecteren - Zod schemas (pbi/story/task): codeField met trim + max-length + regex, optional input (server vult bij ontbreken). Task krijgt voor het eerst een codeField Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
611b621d75
commit
829122d437
5 changed files with 38 additions and 12 deletions
|
|
@ -1,7 +1,15 @@
|
|||
import { z } from 'zod'
|
||||
import { TaskStatus } from '@prisma/client'
|
||||
import { CODE_REGEX, MAX_CODE_LENGTH } from '@/lib/code'
|
||||
|
||||
export const taskSchema = z.object({
|
||||
code: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(MAX_CODE_LENGTH)
|
||||
.regex(CODE_REGEX, 'Ongeldige code')
|
||||
.optional()
|
||||
.or(z.literal('')),
|
||||
title: z.string().trim().min(1, 'Verplicht').max(120),
|
||||
description: z.string().max(2000).optional(),
|
||||
implementation_plan: z.string().max(10000).optional(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue