Commit Graph

5 Commits

Author SHA1 Message Date
fd56561aed Implement Phase 4 settings and security API
- Add GET /api/admin/settings for configuration retrieval
- Add PATCH /api/admin/settings with validation (30-365 days)
- Implement TTL index update when retention period changes
- Add last admin protection (cannot demote last active admin)
- Add audit logging for admin actions (ADMIN_UPDATE_SETTINGS, etc.)
- 45/52 Phase 4 tests passing (7 rate limiting tests not in scope)
2026-01-22 13:25:49 -07:00
40cd0e35bf Implement Phase 3 usage statistics API
- Add GET /api/admin/stats/overview (user counts, login stats)
- Add GET /api/admin/stats/active-users (time series with period toggle)
- Add GET /api/admin/stats/actions (action breakdown with date filter)
- Add GET /api/admin/stats/peak-times (hourly/daily averages)
- Implement 5-minute in-memory caching for expensive aggregations
- All 57 Phase 3 tests passing
2026-01-22 13:10:33 -07:00
c23afdf0b7 Implement Phase 2 activity monitoring API
- Add GET /api/admin/activity with pagination and filters
- Add GET /api/admin/users/:id/activity for user-specific history
- Add GET /api/admin/activity/export for CSV export
- Implement $lookup aggregation for user info (name, email)
- Add date range filtering with validation
- Export limited to 10,000 records with truncation headers
- All 50 Phase 2 tests passing
2026-01-22 13:01:48 -07:00
dbd8d81668 Implement Phase 1 admin dashboard backend
- Add database indexes for admin queries (role, isActive+role, createdAt, lastLoginAt)
- Update setUserActive to track disabledAt and disabledBy fields
- Add getPaginatedUsers function with search, filter, sort support
- Add updateUserRole function for promoting/demoting users
- Create admin routes with full user management API:
  - GET /api/admin/users - paginated list with search/filter/sort
  - GET /api/admin/users/:id - user details with recent activity
  - PATCH /api/admin/users/:id - enable/disable users
  - PATCH /api/admin/users/:id/role - promote/demote users
- Add validation for ObjectId format and self-modification prevention
- All 53 Phase 1 backend tests passing
2026-01-22 12:01:52 -07:00
ef4ddc0de0 Add Google OAuth authentication system (#4)
Some checks failed
Deploy Apartment API / deploy (push) Failing after 1s
Co-authored-by: Stephen Minakian <stephenminakian@gmail.com>
Co-committed-by: Stephen Minakian <stephenminakian@gmail.com>
2026-01-21 19:15:22 -07:00