42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
Markdown
# CRUD Baseline
|
|
|
|
## Scope
|
|
|
|
MVP0 now includes a shared CRUD foundation package: `@cms/crud`.
|
|
|
|
Current baseline:
|
|
|
|
- Shared service factory: `createCrudService`
|
|
- Repository contract: `list`, `findById`, `create`, `update`, `delete`
|
|
- Service surface for list/detail/editor flows: `list`, `getById`, `create`, `update`, `delete`
|
|
- Shared validation error type: `CrudValidationError`
|
|
- Shared not-found error type: `CrudNotFoundError`
|
|
- Shared mutation audit hook contract: `CrudAuditHook`
|
|
- Shared mutation context contract (`actor`, `metadata`)
|
|
|
|
## First Integration
|
|
|
|
`@cms/db` `posts` now uses the shared CRUD foundation:
|
|
|
|
- `listPosts`
|
|
- `getPostById`
|
|
- `createPost`
|
|
- `updatePost`
|
|
- `deletePost`
|
|
- `registerPostCrudAuditHook`
|
|
|
|
Validation for create/update is enforced by `@cms/content` schemas.
|
|
Contract tests validate:
|
|
|
|
- repository list/detail behavior via CRUD service
|
|
- validation and not-found errors
|
|
- audit payload propagation (`actor`, `metadata`)
|
|
|
|
The admin dashboard currently includes a temporary posts CRUD sandbox to validate this flow through a real app UI.
|
|
|
|
## Notes
|
|
|
|
- This is the base layer for future entities (pages, navigation, media, users, commissions).
|
|
- Audit hook persistence/transport is intentionally left for later implementation work.
|
|
- Implementation examples are documented in `crud-examples.md`.
|