feat(product-dialog): conform aan dialog-pattern + entity-profile
Story 2 van PBI "Alle dialogen conform docs/patterns/dialog.md". - lib/schemas/product.ts — gedeeld zod-schema (Dialog API) - actions/products.ts — createProductAction/updateProductAction returnen nu code+fieldErrors voor 422-validatie en code: 403 voor demo/auth - ProductDialog adopt useDirtyCloseGuard, useDialogSubmitShortcut, entityDialog* layout-classes; 422-fieldErrors mappen naar form.setError - docs/specs/dialogs/product.md — entity-profile Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b05c4d241b
commit
03a248b0fb
6 changed files with 310 additions and 181 deletions
18
lib/schemas/product.ts
Normal file
18
lib/schemas/product.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { z } from 'zod'
|
||||
|
||||
export const productSchema = z.object({
|
||||
name: z.string().trim().min(1, 'Naam is verplicht').max(200, 'Maximaal 200 tekens'),
|
||||
code: z.string().trim().max(20, 'Maximaal 20 tekens').optional(),
|
||||
description: z.string().max(4000, 'Maximaal 4000 tekens').optional(),
|
||||
repo_url: z
|
||||
.string()
|
||||
.url('Voer een geldige URL in (inclusief https://)')
|
||||
.regex(/^https:\/\/github\.com\//, 'Alleen GitHub-URLs worden ondersteund')
|
||||
.optional()
|
||||
.nullable()
|
||||
.or(z.literal('')),
|
||||
definition_of_done: z.string().max(4000, 'Maximaal 4000 tekens').optional(),
|
||||
auto_pr: z.boolean(),
|
||||
})
|
||||
|
||||
export type ProductInput = z.infer<typeof productSchema>
|
||||
Loading…
Add table
Add a link
Reference in a new issue