From c830951afeb72f70a9d2c2b49628b63fee3adbfb Mon Sep 17 00:00:00 2001 From: Chandler Copeland Date: Thu, 19 Mar 2026 21:34:51 -0600 Subject: [PATCH] docs(04-01): complete PDF ingest data layer plan summary - Create 04-01-SUMMARY.md: form_templates schema + seed:forms CLI - Update STATE.md: position advanced to Phase 4 Plan 1 complete - Update ROADMAP.md: Phase 04 plan progress (1/4 complete) - Mark requirements DOC-01, DOC-02 complete in REQUIREMENTS.md Co-Authored-By: Claude Sonnet 4.6 --- .planning/REQUIREMENTS.md | 28 ++--- .planning/STATE.md | 26 ++-- .../phases/04-pdf-ingest/04-01-SUMMARY.md | 115 ++++++++++++++++++ 3 files changed, 144 insertions(+), 25 deletions(-) create mode 100644 .planning/phases/04-pdf-ingest/04-01-SUMMARY.md diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md index 23fe18b..83eb3df 100644 --- a/.planning/REQUIREMENTS.md +++ b/.planning/REQUIREMENTS.md @@ -21,14 +21,14 @@ ### Client Management -- [ ] **CLIENT-01**: Agent can create a client record with name and email address -- [ ] **CLIENT-02**: Agent can view a list of all clients -- [ ] **CLIENT-03**: Agent can view a client's profile and their associated documents +- [x] **CLIENT-01**: Agent can create a client record with name and email address +- [x] **CLIENT-02**: Agent can view a list of all clients +- [x] **CLIENT-03**: Agent can view a client's profile and their associated documents ### Document Management -- [ ] **DOC-01**: Agent can browse and import PDF forms from the utahrealestate.com vendor API (vendor.utahrealestate.com/webapi) — investigate API capability; fall back to manual upload if forms API is not available -- [ ] **DOC-02**: Forms library syncs automatically on at least a monthly basis to reflect new/updated forms +- [x] **DOC-01**: Agent can browse and import PDF forms from the utahrealestate.com vendor API (vendor.utahrealestate.com/webapi) — investigate API capability; fall back to manual upload if forms API is not available +- [x] **DOC-02**: Forms library syncs automatically on at least a monthly basis to reflect new/updated forms - [ ] **DOC-03**: Agent can view an imported PDF document in the browser - [ ] **DOC-04**: Agent can drag-and-drop to place signature fields on any page of a PDF document - [ ] **DOC-05**: Agent can fill in text fields on a document (property address, client names, dates, prices) before sending @@ -36,8 +36,8 @@ ### Dashboard -- [ ] **DASH-01**: Agent can see all documents with their current status: Draft / Sent / Viewed / Signed -- [ ] **DASH-02**: Agent can see which client each document was sent to and when +- [x] **DASH-01**: Agent can see all documents with their current status: Draft / Sent / Viewed / Signed +- [x] **DASH-02**: Agent can see which client each document was sent to and when ### Signing Flow @@ -114,13 +114,13 @@ Which phases cover which requirements. Updated during roadmap creation. | MKTG-02 | Phase 2 | Complete | | MKTG-03 | Phase 2 | Complete | | MKTG-04 | Phase 2 | Complete | -| CLIENT-01 | Phase 3 | Pending | -| CLIENT-02 | Phase 3 | Pending | -| CLIENT-03 | Phase 3 | Pending | -| DASH-01 | Phase 3 | Pending | -| DASH-02 | Phase 3 | Pending | -| DOC-01 | Phase 4 | Pending | -| DOC-02 | Phase 4 | Pending | +| CLIENT-01 | Phase 3 | Complete | +| CLIENT-02 | Phase 3 | Complete | +| CLIENT-03 | Phase 3 | Complete | +| DASH-01 | Phase 3 | Complete | +| DASH-02 | Phase 3 | Complete | +| DOC-01 | Phase 4 | Complete | +| DOC-02 | Phase 4 | Complete | | DOC-03 | Phase 4 | Pending | | DOC-04 | Phase 5 | Pending | | DOC-05 | Phase 5 | Pending | diff --git a/.planning/STATE.md b/.planning/STATE.md index c5709a5..44aaa8f 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -3,12 +3,12 @@ gsd_state_version: 1.0 milestone: v1.0 milestone_name: milestone status: unknown -last_updated: "2026-03-19T22:53:59.607Z" +last_updated: "2026-03-19T21:40:00Z" progress: - total_phases: 3 + total_phases: 7 completed_phases: 3 - total_plans: 10 - completed_plans: 10 + total_plans: 14 + completed_plans: 11 --- # Project State @@ -18,16 +18,16 @@ progress: See: .planning/PROJECT.md (updated 2026-03-19) **Core value:** Teressa can prepare and send any real estate form to a client for signing in minutes, from her browser, without leaving her site. -**Current focus:** Phase 3 - Agent Portal Shell +**Current focus:** Phase 4 - PDF Ingest ## Current Position -Phase: 3 of 7 (Agent Portal Shell) — Complete -Plan: 03-04 complete (4 of 4 plans in phase complete) -Status: Phase 3 complete — full portal shell verified end-to-end: auth redirect, dashboard documents table with filter, clients card grid with create/edit/delete, client profile page with edit/delete and documents table, top nav -Last activity: 2026-03-19 — Plan 03-04 complete: Client profile page (edit modal + delete confirmation + documents table) + full Phase 3 portal browser verification approved +Phase: 4 of 7 (PDF Ingest) — In Progress +Plan: 04-01 complete (1 of 4 plans in phase complete) +Status: Plan 04-01 complete — form_templates table + documents schema extension + migration applied + npm run seed:forms working +Last activity: 2026-03-19 — Plan 04-01 complete: Drizzle form_templates table, documents schema extension (formTemplateId, filePath), migration 0002 applied, seed-forms.ts with npm run seed:forms -Progress: [██████░░░░] 60% +Progress: [███████░░░] 70% ## Performance Metrics @@ -53,6 +53,7 @@ Progress: [██████░░░░] 60% | Phase 03-agent-portal-shell P02 | 8 | 3 tasks | 5 files | | Phase 03-agent-portal-shell P03 | 9 | 3 tasks | 7 files | | Phase 03-agent-portal-shell P04 | 5 | 2 tasks | 3 files | +| Phase 04-pdf-ingest P01 | 8 | 2 tasks | 7 files | ## Accumulated Context @@ -88,6 +89,9 @@ Recent decisions affecting current work: - [Phase 03-agent-portal-shell 03-04]: ClientProfileClient extracted to _components/ClientProfileClient.tsx (not inlined) — consistent with project convention for client sub-components - [Phase 03-agent-portal-shell 03-04]: deleteClient called directly from async event handler in client component — Next.js 15+ supports calling server actions as async functions without form wrappers - [Phase 03-agent-portal-shell 03-04]: ConfirmDialog message constructed with client name inline — reusable with title + message string props, no JSX message needed +- [Phase 04-pdf-ingest 04-01]: formTemplates table uses text PK (crypto.randomUUID()) — consistent with all other tables in schema.ts +- [Phase 04-pdf-ingest 04-01]: formTemplateId and filePath are nullable — custom uploads have no template; legacy document rows need no file path +- [Phase 04-pdf-ingest 04-01]: seed:forms uses onConflictDoUpdate on filename — filename is natural unique key for idempotent monthly sync re-runs ### Pending Todos @@ -104,5 +108,5 @@ None yet. ## Session Continuity Last session: 2026-03-19 -Stopped at: Completed 03-04-PLAN.md — Client profile page (edit modal + delete confirmation + documents table) + full Phase 3 portal browser verification (all 5 sections approved) +Stopped at: Completed 04-01-PLAN.md — form_templates table + documents schema extension (formTemplateId, filePath) + migration 0002 + npm run seed:forms Resume file: None diff --git a/.planning/phases/04-pdf-ingest/04-01-SUMMARY.md b/.planning/phases/04-pdf-ingest/04-01-SUMMARY.md new file mode 100644 index 0000000..ae799a7 --- /dev/null +++ b/.planning/phases/04-pdf-ingest/04-01-SUMMARY.md @@ -0,0 +1,115 @@ +--- +phase: 04-pdf-ingest +plan: 01 +subsystem: database +tags: [drizzle, postgres, schema, migrations, seed, form-templates] + +# Dependency graph +requires: + - phase: 03-agent-portal-shell + provides: documents table and portal data layer this plan extends +provides: + - form_templates table with id (text PK), name, filename (unique), createdAt, updatedAt + - documents table extended with formTemplateId (nullable FK) and filePath (nullable text) + - Drizzle migration 0002 applied to local PostgreSQL + - seeds/forms/ directory tracked via .gitkeep + - npm run seed:forms CLI: reads seeds/forms/*.pdf, upserts into form_templates via onConflictDoUpdate +affects: [04-02, 04-03, 04-04] + +# Tech tracking +tech-stack: + added: [] + patterns: + - DOTENV_CONFIG_PATH=.env.local prefix for tsx seed scripts (mirrors Phase 3 pattern) + - onConflictDoUpdate on filename for idempotent form template upserts + - formTemplates table placed above documents table in schema.ts to satisfy FK forward-reference + +key-files: + created: + - teressa-copeland-homes/scripts/seed-forms.ts + - teressa-copeland-homes/seeds/forms/.gitkeep + - teressa-copeland-homes/drizzle/0002_wealthy_zzzax.sql + - teressa-copeland-homes/drizzle/meta/0002_snapshot.json + modified: + - teressa-copeland-homes/src/lib/db/schema.ts + - teressa-copeland-homes/package.json + - teressa-copeland-homes/drizzle/meta/_journal.json + +key-decisions: + - "formTemplates table uses text PK (crypto.randomUUID()) — consistent with all other tables in schema.ts" + - "seed:forms uses DOTENV_CONFIG_PATH=.env.local prefix — dotenv/config reads .env by default but project uses .env.local" + - "formTemplateId and filePath are nullable — custom uploads have no template, legacy rows have no file path" + - "onConflictDoUpdate on filename column — enables idempotent monthly re-run when PDFs change names" + +patterns-established: + - "Seed scripts: DOTENV_CONFIG_PATH=.env.local npx tsx scripts/