# Phase 2: Plant Touch Points & IPM - Execution Plan ## 🚨 Status Check Most of Phase 2 logic was scaffolded in the previous session but left unconnected. We have a **critical bug** on the Dashboard (calling a missing API method) and some missing backend endpoints. --- ## 🏃 Sprint 1: Fix Dashboard & Connect APIs (✅ COMPLETE) **Goal**: Resolve the Dashboard crash and ensure the "Recent Use" feed works. ### Tasks 1. **Backend (`touch-points.controller.ts`)**: - ✅ Implement `getRecentTouchPoints` to return the latest 50 touch points globally (across all batches). 2. **Backend Routes**: - ✅ Verify `GET /api/touch-points` maps to this new controller method. 3. **Frontend (`touchPointsApi.ts`)**: - ✅ Add `getAll()` method (or `getRecent()`) to match the Dashboard's expectation. 4. **Backend Fixes**: - ✅ Fix typo `getShedule` -> `getSchedule` in `ipm.controller.ts`. --- ## 🏃 Sprint 2: IPM & Integrations **Goal**: Verify the IPM scheduling loop works end-to-end. ### Tasks 1. **Database**: - Ensure `PlantTouchPoint` and `IPMSchedule` tables exist (run `npx prisma db push` to be safe). 2. **Frontend Verification**: - Test "Log Touch Point" from the Dashboard. - Test "IPM Dashboard" loading due treatments. 3. **Logic Check**: - Verify treating a plant (`type: "IPM"`) correctly updates the `nextTreatment` date in `IPMSchedule`. --- ## ❓ User Action Required - None immediately. I will proceed with Sprint 1 to fix the Dashboard crash.