feat: add document CRUD API and document list UI#30
Conversation
Add backend endpoints for document management (list, create, get, update, delete) under /api/projects/:projectId/documents with R2 content storage and revision tracking. Update ProjectDetailPage to display documents with create/delete actions. Add comprehensive tests for all document endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Loom Judge Review -- APPROVEDReviewed all three changed files: What looks good
Minor observations (non-blocking)
VerdictClean implementation that follows established patterns. Approving. Reviewed by Loom Judge |
Summary
Implement document management backend API endpoints and integrate document listing into the ProjectDetailPage UI, enabling users to create, read, update, and delete documents within projects.
Changes
functions/api/[[route]].ts: list, get, create, update (with revision tracking), and delete (with R2 cleanup)/api/projects/:projectId/documentsand/api/projects/:projectId/documents/:docIdverifyProjectOwnershiphelper to authorize document operationssrc/pages/ProjectDetailPage.tsxwith a Documents section showing document list, "New Document" button, delete per document, and links to the edit pagefunctions/api/__tests__/documents.test.tswith 10 tests covering all document endpoints (auth, validation, CRUD, R2 interactions)Acceptance Criteria Verification
Test Plan
pnpm run buildpasses (tsc + vite)pnpm run lint:fixpasses (biome)pnpm run test-- all 85 tests pass; 3 pre-existing empty suite failures in packages/ are unrelatedCloses #13