- Remove authenticate/authorize from GET /login-accounts (needed by login page before auth)
- Revert repository to use include instead of select (matches frontend expectations)
- Frontend calls this endpoint unauthenticated to show demo accounts
feat: Architecture & security improvements for scale
Phase 1 - Security:
- Protect /auth/login-accounts with authenticate + authorize('superAdmin')
- Implement refresh token revocation with DB persistence + token rotation
- Add per-endpoint rate limiting for /auth/login and /auth/forgot-password
- Enforce gymId + id compound where clauses for tenant isolation
Phase 2 - Database:
- Add RefreshToken model with revocation support
- Add isDemoAccount flag to User (replaces N+1 bcrypt in loginAccounts)
- Add missing indexes: Member.qrToken, Member.barcodeId,
Attendance.memberId+checkIn, Notification.gymId+status+createdAt
Phase 3 - Performance:
- Add Redis caching layer (cached/invalidateCache utilities)
- Cache gym hours with 5min TTL in sessions controller
- Add pagination to sessions list endpoint (was fetching ALL sessions)
- Optimize QR check-in to single CTE query (was 3-4 sequential queries)
- Cache active subscription status for 5min in attendance service
- Add MAX_LIMIT=100 validation to pagination utility
- Create sessions repos…