feat(i18n): complete super-admin i18n — all 11 pages fully translated
CognxSafeTrack
b92ea37
All 11 super-admin pages now use useTranslation for every visible string.
Adds rel_today/rel_yesterday/rel_days_ago keys for WhatsAppProfiles relativeDate,
tpl_cat_*_desc keys for template category descriptions, and fixes the
SuperAdminLayout NAV_ITEMS destructuring (labelKey vs label).
fix(security): resolve critical and high technical debt from audit
CognxSafeTrack
a8e18d6
CRITICAL:
- Exclude passwordHash from enrollment list response (admin.ts)
- Add sanitizeOrg() to strip API keys/tokens from all org GET responses
- Fix CORS wildcard on SSE stream; use request origin instead
- Restrict super-admin routes to SUPER_ADMIN role only (was also allowing ADMIN)
- Replace all Zod .parse() with .safeParse() → proper 400s instead of 500s (ai.ts, admin.ts)
HIGH:
- Increase ExerciseHandler Redis dedup lock from 30s to 300s
- Add take:500 to unbounded trainingData.findMany (OOM risk)
- Add take limits to message/contact findMany queries
- Add Redis lock in EnrollHandler to prevent duplicate enrollments (TOCTOU)
- Wrap override-feedback in try/catch; return 404 on P2025
- Use atomic increment for wallet credits (was TOCTOU race condition)
- Scope messages/send to requesting org (was cross-org accessible)
MEDIUM:
- decryptSecrets returns new object instead of mutating argument in-place
- GeminiProvider.generateStructuredData now validates response with Zod schema
-…
fix(super-admin): guard null wabaId, org.id, amount in profiles/templates/billing/AI pages
CognxSafeTrack
b5dcbdb
feat(super-admin): WhatsApp OTP registration and template creation
CognxSafeTrack
170eb5d
- WhatsApp service: add registerPhoneNumber() and verifyPhoneNumber() methods
- Super-admin routes: POST /whatsapp/numbers/register and /verify for Meta OTP flow
- Super-admin routes: POST /whatsapp/templates to submit templates to Meta for approval
- WhatsAppNumbers page: 2-step modal (orgId + phoneNumberId + PIN → OTP code)
- WhatsAppTemplates page: full creation modal with category cards, char counters, live preview bubble
feat(super-admin): org delete, user password reset, complete CRUD coverage
CognxSafeTrack
b8629ec
Backend:
- DELETE /v1/super-admin/organizations/:id — soft-delete via
subscriptionStatus='DELETED' + isHardStopped=true
- POST /v1/super-admin/users/:id/reset-password — generates 1h JWT
reset token, emails link via scheduleEmail (same flow as /forgot-password)
Frontend:
- OrganizationsManager: red trash icon per row calls DELETE; confirmation
dialog before destructive action; suspend icon color changed to amber
- UsersManager: key icon per row calls reset-password endpoint; guards
against users with no email address
feat: complete super-admin interface + enforce Day 11 photo requirement
CognxSafeTrack
8f2286f
Super-admin (3 missing pages + 3 new backend routes):
- AuditLogs page: date-range / action filter, paginated table with
inline JSON detail expansion
- WhatsAppTemplates page: org directory with lazy per-org template
fetch; category/status badges; expandable template panel per row
- WhatsAppProfiles page: card grid showing org branding (logo, color,
WABA ID, token age); inline edit form with live logo preview and
color picker; PATCH /v1/super-admin/whatsapp/profiles/:id
- Backend: GET /audit-logs, GET/PATCH /whatsapp/profiles,
GET /whatsapp/templates added to super-admin.ts
- SuperAdminLayout: 10 nav items (added Templates WA, Profils WA,
Audit Logs); SuperAdminRouter wired to all new routes
Day 11 photo enforcement (tasks/todo.md item resolved):
- FeedbackHandler: if currentDay === 11 and no imageUrl, send
multilingual photo prompt and return early — exercise cannot be
validated without a team member photo
When selectedOrgId === 'xamle-admin-org', the admin switches to a full
platform management dashboard instead of the normal org layout.
Backend (apps/api):
- New /v1/super-admin/* routes (SUPER_ADMIN/ADMIN role required):
platform stats, organizations CRUD + suspend + impersonate,
cross-org users + role change, WhatsApp numbers, billing
transactions + manual credits, monitoring health, AI agentic command
- Fixed SQL injection in analytics text-to-SQL (UNION/DROP/comment blocking)
- Removed JWT secret fallback — crashes on startup if JWT_SECRET is missing
- Added ORG_ADMIN role guard to all /v1/admin/* routes
Frontend (apps/admin):
- SuperAdminRouter: nested routes under /platform/*
- SuperAdminLayout: dark sidebar (slate-950/violet), 7 nav items
- PlatformDashboard: 6 KPI cards, system health, active alerts
- OrganizationsManager: searchable table, suspend/edit drawer, create modal
- UsersManager: cross-org table with inline role-change
- WhatsAppNumbers: all registered numbers …