Backend: - app/models/email_log.py: EmailLog table (school_id, to, subject, type, status, error, sent_at) with EmailType + EmailStatus enums - migrations/002_phase9_email_logs.py: Alembic migration for email_logs table - app/templates/email/: 6 Jinja2 HTML templates — base layout, invoice, low_credit, license_expiry, overdue_warning, suspension - app/services/email.py: enhanced send_email() — accepts template_name+context for HTML rendering, logs every attempt to email_logs, retries up to 3x on transient SMTP failure with exponential backoff - app/routers/email.py: GET /api/email/logs (paginated, filterable by type/status/school), POST /api/email/test (send test email, super admin) - tasks/billing.py: invoice + overdue warning + suspension emails now use HTML templates - tasks/sms.py: low credit alert now uses HTML template - tasks/license.py: expiry warning now uses HTML template - app/main.py + migrations/env.py: wire in email_log model + email router Frontend: - EmailLogsPage.vue: table with to/subject/type badge/status badge/sent_at/error, type+status filters, pagination, Send Test Email modal - router/index.ts: /email-logs route - AppSidebar.vue: Email Logs nav item - api.ts: getEmailLogs, sendTestEmail
2.9 KiB
2.9 KiB
TapTrack Hub — PAUL State
Current Position
Milestone: v1.0 — Foundation & Core Services Phase: 9 of 15 (Email Dispatcher — complete) Plan: Phase 9 complete — Phase 10 next Status: Phase 9 applied — ready to begin Phase 10 Last activity: 2026-03-16 — Phase 9 complete (HTML email templates, email_logs table, enhanced send_email with template rendering + delivery logging + retries, email logs UI + test-email)
Loop Position
PLAN ──▶ APPLY ──▶ UNIFY
· · · [No active plan — Phase 10 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): [██████████] 100% ✓
- Phase 6 (Super Admin Dashboard UI): [██████████] 100% ✓
- Phase 7 (School Admin Portal UI): [██████████] 100% ✓
- Phase 8 (Billing Engine + Invoice PDF): [██████████] 100% ✓
- Phase 9 (Email Dispatcher): [██████████] 100% ✓
- 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 10 — Support Ticket System
Resume file: .paul/ROADMAP.md → Phase 10
Repo
Remote: TBD (new Gitea repo) Branch: master Last commit: feat(phase-9): email dispatcher — HTML templates, delivery log, test endpoint
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