Scrum4Me/lib/schemas/story.ts
Madhura68 01e77fc560 feat(story-dialog): conform aan dialog-pattern + AlertDialog delete
Story 4 van PBI "Alle dialogen conform docs/patterns/dialog.md".

- lib/schemas/story.ts — gedeeld zod-schema
- actions/stories.ts — code+fieldErrors voor 422; code: 403 voor auth/demo
- StoryDialog adopt useDirtyCloseGuard, useDialogSubmitShortcut,
  entityDialog* layout-classes
- Inline delete-confirm vervangen door AlertDialog (§10.4)
- docs/specs/dialogs/story.md — gaps weggewerkt; alleen bewuste
  afwijkingen blijven (header met badges, geen char-counter)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 07:26:56 +02:00

26 lines
888 B
TypeScript

import { z } from 'zod'
import { MAX_CODE_LENGTH } from '@/lib/code'
const codeField = z.string().max(MAX_CODE_LENGTH).optional()
export const createStorySchema = z.object({
pbiId: z.string(),
productId: z.string(),
code: codeField,
title: z.string().min(1, 'Titel is verplicht').max(200),
description: z.string().max(2000).optional(),
acceptance_criteria: z.string().max(2000).optional(),
priority: z.coerce.number().int().min(1).max(4),
})
export const updateStorySchema = z.object({
id: z.string(),
code: codeField,
title: z.string().min(1, 'Titel is verplicht').max(200),
description: z.string().max(2000).optional(),
acceptance_criteria: z.string().max(2000).optional(),
priority: z.coerce.number().int().min(1).max(4),
})
export type CreateStoryInput = z.infer<typeof createStorySchema>
export type UpdateStoryInput = z.infer<typeof updateStorySchema>