feat(phase-4): SMS gateway dashboard + stats + health + retry

Backend (backend/app/routers/sms.py):
- GET /api/sms/stats: aggregate totals by status, daily volume chart
  (configurable N days), per-school top-10 breakdown, delivery rate,
  live queue depth
- POST /api/sms/jobs/{id}/retry: reset failed/cancelled job to pending
- GET /api/sms/health: Semaphore API connectivity check + credit balance
- POST /api/sms/trigger-queue: manually fire sms.process_queue Celery task

Frontend (frontend/src/pages/SmsPage.vue) — rebuilt from scratch:
- Semaphore health badge with live status indicator and balance display
- 'Process Queue' button calling POST /api/sms/trigger-queue
- KPI row: Total, Sent, Failed, Pending (queue depth), Delivery Rate %;
  period picker switching between 7/30/90 day views
- Volume bar chart: daily sent vs failed bars with hover tooltips,
  x-axis date labels, legend; no charting library required
- School breakdown panel: top 10 schools by volume with delivery
  percentage bars
- Jobs table: status + school + phone number filters; inline error
  message on failed rows; Retry button for failed/cancelled jobs;
  retry count display; pagination

api.ts: getSmsStats, retrySmsJob, getSmsHealth, triggerSmsQueue

PAUL: Phase 4 marked complete, STATE + ROADMAP updated
This commit is contained in:
kevin-asprec
2026-03-16 10:37:23 +08:00
parent a5430736d9
commit 5cab1938b1
6 changed files with 512 additions and 38 deletions

View File

@@ -3,10 +3,10 @@
## Current Position
Milestone: v1.0 — Foundation & Core Services
Phase: 3 of 15 (On-Prem License Validation — complete)
Plan: Phase 3 complete — Phase 4 next
Status: **Phase 3 applied — ready to begin Phase 4**
Last activity: 2026-03-15 — Phase 3 complete (TapTrack on-prem: license validation task, startup check, hub router, frontend warning banner)
Phase: 4 of 15 (SMS Gateway — complete)
Plan: Phase 4 complete — Phase 5 next
Status: **Phase 4 applied — ready to begin Phase 5**
Last activity: 2026-03-15 — Phase 4 complete (SMS stats/health/retry/trigger endpoints + full SmsPage dashboard with chart, KPIs, school breakdown)
## Loop Position
@@ -22,7 +22,7 @@ PLAN ──▶ APPLY ──▶ UNIFY
- Phase 1 (Project Setup & Infrastructure): [██████████] 100% ✓
- Phase 2 (School Registry + License Mgmt): [██████████] 100% ✓
- Phase 3 (On-Prem License Validation): [██████████] 100% ✓
- Phase 4 (SMS Gateway): [░░░░░░░░░░] 0%
- Phase 4 (SMS Gateway): [██████████] 100% ✓
- Phase 5 (On-Prem SMS Polling Agent): [░░░░░░░░░░] 0%
- Phase 6 (Super Admin Dashboard UI): [░░░░░░░░░░] 0%
- Phase 7 (School Admin Portal UI): [░░░░░░░░░░] 0%
@@ -37,8 +37,8 @@ PLAN ──▶ APPLY ──▶ UNIFY
## Next Action
Run: `/paul:plan` for Phase 4SMS Gateway (credits + queue)
Resume file: .paul/ROADMAP.md → Phase 4
Run: `/paul:plan` for Phase 5On-Prem SMS Polling Agent
Resume file: .paul/ROADMAP.md → Phase 5
## Repo