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:
Janpeter Visser 2026-05-04 07:18:39 +02:00
parent b05c4d241b
commit 03a248b0fb
6 changed files with 310 additions and 181 deletions

View file

@ -107,7 +107,10 @@ describe('createProductAction', () => {
const result = await createProductAction(VALID_DATA)
expect(result).toMatchObject({ error: expect.stringContaining('gebruik') })
expect(result).toMatchObject({
code: 422,
fieldErrors: { code: expect.arrayContaining([expect.stringContaining('gebruik')]) },
})
expect(mockTransaction).not.toHaveBeenCalled()
})