Plans 04-01 through 04-04 cover DOC-01, DOC-02, DOC-03: schema/seed, API routes, UI modal + PDF viewer, human verification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5.4 KiB
5.4 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 04-pdf-ingest | 04 | execute | 4 |
|
false |
|
|
Purpose: Functional verification catches UI/UX issues that automated checks miss — blank PDFs, missing form items, broken nav controls. Output: Phase 4 approved or issues logged for gap closure.
<execution_context> @/Users/ccopeland/.claude/get-shit-done/workflows/execute-plan.md @/Users/ccopeland/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/phases/04-pdf-ingest/04-CONTEXT.md Complete Phase 4 PDF ingest pipeline: - forms_templates DB table + seed script (npm run seed:forms) - GET /api/forms-library — authenticated template list - POST /api/documents — creates document record + copies PDF to uploads/clients/{id}/ - GET /api/documents/[id]/file — authenticated PDF streaming with path traversal protection - "Add Document" modal on client profile page with searchable library + file picker fallback - Document detail page with react-pdf viewer (page nav, zoom, download) Run the dev server if not already running: ``` cd teressa-copeland-homes && npm run dev ```**Step 1 — Seed a test form (if seeds/forms/ is empty):**
- Download any real estate PDF (or use any PDF) and copy it to `teressa-copeland-homes/seeds/forms/purchase-agreement.pdf`
- Run: `npm run seed:forms`
- Confirm output: "Seeded 1 forms into form_templates."
**Step 2 — Open a client profile:**
- Log in at http://localhost:3000/login
- Navigate to Clients, click on any client
- Confirm: "Add Document" button is visible on the client profile page
**Step 3 — Add document from library:**
- Click "Add Document"
- Confirm: modal opens with a searchable list (shows "purchase agreement" or whatever was seeded, OR "No forms found" if seeds are empty)
- Type in the search box — confirm list filters
- Click a form to select it — confirm document name pre-fills
- Edit the name to something like "Test Purchase Agreement"
- Click "Add Document"
- Confirm: modal closes, new document appears in the documents list on the profile page
**Step 4 — Add custom PDF via file picker:**
- Click "Add Document" again
- Click "Browse files" / the file input
- Select any PDF from your computer
- Confirm: name pre-fills from filename
- Edit name, submit
- Confirm: document appears in the list
**Step 5 — View PDF in browser:**
- Click a document name from the documents list
- Confirm: navigates to `/portal/documents/{id}`
- Confirm: PDF renders (pages visible — NOT blank white)
- Confirm: "Prev" / "Next" buttons work for multi-page PDFs
- Confirm: "Zoom In" / "Zoom Out" buttons change page size
- Confirm: "Download" button downloads the PDF
- Confirm: "Back to [Client Name]" link returns to the client profile
**Step 6 — Verify file storage:**
- Check that `teressa-copeland-homes/uploads/clients/{clientId}/` directory contains `.pdf` files
- Confirm files persist after stopping and restarting the dev server
**Step 7 — Verify authentication:**
- In an incognito window (no session), try: http://localhost:3000/api/forms-library
- Confirm: returns "Unauthorized" (not a PDF list)
- Try: http://localhost:3000/api/documents/any-id/file
- Confirm: returns "Unauthorized" (not a file)
Type "approved" if all 7 steps pass.
Or describe any issues found (e.g., "PDF renders blank", "modal list empty", "upload fails").
All 7 verification steps pass as described above.
<success_criteria> Agent confirms: forms library accessible, document creation from template works, custom upload works, PDF renders with navigation controls, files stored in uploads/, unauthenticated API access blocked. </success_criteria>
After completion, create `.planning/phases/04-pdf-ingest/04-04-SUMMARY.md`