Files
TapTrack-Hub/.paul/STATE.md
kevin-asprec 5cab1938b1 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
2026-03-16 10:37:23 +08:00

65 lines
2.7 KiB
Markdown

# TapTrack Hub — PAUL State
## Current Position
Milestone: v1.0 — Foundation & Core Services
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
```
PLAN ──▶ APPLY ──▶ UNIFY
· · · [No active plan — Phase 2 planning next]
```
## Progress
### v1.0 Foundation
- Phase 1 (Project Setup & Infrastructure): [██████████] 100% ✓
- Phase 2 (School Registry + License Mgmt): [██████████] 100% ✓
- Phase 3 (On-Prem License Validation): [██████████] 100% ✓
- 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%
- Phase 8 (Billing Engine + Invoice PDF): [░░░░░░░░░░] 0%
- Phase 9 (Email Dispatcher): [░░░░░░░░░░] 0%
- Phase 10 (Support Ticket System): [░░░░░░░░░░] 0%
- Phase 11 (Monthly Report Generation): [░░░░░░░░░░] 0%
- Phase 12 (On-Prem Monthly Report Pull): [░░░░░░░░░░] 0%
- Phase 13 (Feature Flags + Suspension): [░░░░░░░░░░] 0%
- Phase 14 (Onboarding Wizard): [░░░░░░░░░░] 0%
- Phase 15 (UX Polish + Ops Tools): [░░░░░░░░░░] 0%
## Next Action
Run: `/paul:plan` for Phase 5 — On-Prem SMS Polling Agent
Resume file: .paul/ROADMAP.md → Phase 5
## Repo
Remote: TBD (new Gitea repo)
Branch: master
Last commit: initial scaffold
## Tech Stack
- Backend: FastAPI 0.115 + SQLAlchemy 2 async + PostgreSQL 15 + Redis 7
- Worker: Celery 5.4 + celery-beat
- Email: SMTP via smtplib + Jinja2 HTML templates
- SMS: Semaphore PH API (single account, proxied for all schools)
- Frontend: Vue 3.5 + Vite + Pinia + Vue Router + Tailwind CSS 3
- Infra: Docker Compose + Nginx reverse proxy
## Architecture Notes
- Two user roles: super_admin (operator) + school_admin (client)
- Two frontend layouts: AppLayout (super admin nav) + PortalLayout (school portal nav)
- SMS flow: on-prem polls /api/sync/poll every 30s → Hub queues/sends via Semaphore
- License flow: on-prem calls /api/licenses/validate on startup + every 6h
- No inbound firewall rules needed — all communication is on-prem → Hub outbound