Overview
src/app/api/approvals/route.ts uses a module-level Map as its data store. Content submitted for approval disappears on every server restart or cold start. In a production environment with autoscaling or periodic restarts, this makes the approval workflow completely unreliable.
Specifications
Features:
- Approval submissions are persisted to the database
- The approval queue survives restarts and works across multiple server instances
Tasks:
- Create a content_approvals table with all ApprovalItem fields
- Replace in-memory CRUD operations with SQL queries
- Update GET/POST/PATCH handlers to be async with proper error handling
- Migrate the generateId helper to use uuid for database-compatible IDs
Impacted Files:
- src/app/api/approvals/route.ts
- src/lib/db/ (new migration)
Acceptance Criteria
- Approval items persist across server restarts
- Two concurrent server instances see the same approval queue
- GET /api/approvals returns items from the database, not module memory
Overview
src/app/api/approvals/route.ts uses a module-level Map as its data store. Content submitted for approval disappears on every server restart or cold start. In a production environment with autoscaling or periodic restarts, this makes the approval workflow completely unreliable.
Specifications
Features:
Tasks:
Impacted Files:
Acceptance Criteria