# Refactoring Progress & Plan ## ✅ Completed Tasks (v6.2.5) ### CRM v2.5 Implementation - **Migration 6.2.5**: Added `department_id` to `crm_deals`, SLA tables - **Schema**: Added `attendance_sla_policies` and `attendance_sla_events` tables - **Structs**: Added `department_id` to `CrmDeal`, updated `ListQuery` with filters - **API**: Department filtering on `list_leads` and `list_opportunities` - **SLA Module**: Created `attendance/sla.rs` with breach detection background task - **Tests**: Unit tests for CRM and SLA modules - **Documentation**: Updated `sales-pipeline.md` with new stages and department filtering - **Consolidation**: Merged `crm-marketing.md`, `crm-sales.md`, `crm-service.md` → `crm.md` ### Previous Fixes - WhatsApp Adapter Error Handling - Third-Party Config Robustness - BASIC Script Preprocessing ## ❌ Pending (Full Implementation) 1. **Unified `/api/crm/deals` routes** - Add CRUD handlers 2. **Marketing campaign execution** - `send_campaign` in triggers.rs 3. **Marketing dynamic lists refresh** - Query-based list resolution 4. **Email tracking endpoints** - Open/click pixel tracking 5. **Marketing AI content generation** - LLM prompt integration 6. **Attendance skills-based routing** - Filter by attendant preferences 7. **Attendance webhooks** - HMAC-signed POST events 8. **Attendance kanban endpoint** - Sessions grouped by status 9. **WhatsApp attendant commands** - /queue, /take, /tips, etc. ## 📋 Current Status - `cargo check -p botserver`: ✅ - `cargo clippy -p botserver`: ✅ (0 warnings) - Migration ready: ✅ See `prompts/crm.md` for detailed implementation guide.