docs: update documentation with Activity Log System implementation
Updated all major documentation files to reflect the completed Activity Log System (Phase 3.5) implementation. Changes: - README.md: Added Admin & Monitoring section, updated database schema to 12 tables, added Activity Log System to completed phases, updated project structure to show admin pages and services - SESSION_CONTEXT.md: Updated recent work, added activity log system to core features, updated database schema, added comprehensive Phase 3.5 overview with all implementation details - COMPLETED.md: Added full Activity Log System entry with all 8 phases, implementation details, git commits, and access information Updated dates to 2025-12-02.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
**Phase:** MVP Complete - Production Ready
|
||||
**Tests:** 342/342 backend tests passing - 100% ✅ (72.5% coverage)
|
||||
**Recent Work:** Matching runs audit, ratings & stats system, comprehensive test suite
|
||||
**Recent Work:** Activity Log System with real-time admin dashboard (Phase 3.5 complete)
|
||||
|
||||
### Core Features (All Implemented)
|
||||
- JWT authentication with email verification (AWS SES)
|
||||
@@ -37,6 +37,7 @@
|
||||
- PWA (offline support, iOS compatible)
|
||||
- Security: CSRF, rate limiting, account lockout
|
||||
- Test bot for automated testing
|
||||
- Activity Log System - admin monitoring dashboard with real-time streaming (18 action types)
|
||||
|
||||
---
|
||||
|
||||
@@ -47,6 +48,7 @@
|
||||
├── docker-compose.yml # nginx:8080 + frontend + backend + db
|
||||
├── frontend/src/
|
||||
│ ├── pages/ # React pages
|
||||
│ │ └── admin/ # Admin pages (ActivityLogsPage.jsx)
|
||||
│ ├── components/ # Reusable components
|
||||
│ ├── contexts/ # AuthContext
|
||||
│ ├── services/ # api.js, socket.js
|
||||
@@ -55,8 +57,10 @@
|
||||
├── backend/src/
|
||||
│ ├── routes/ # API endpoints (events.js, matches.js, admin.js)
|
||||
│ ├── controllers/ # Business logic
|
||||
│ ├── services/ # matching.js (auto-matching algorithm)
|
||||
│ ├── socket/ # Socket.IO handlers
|
||||
│ ├── services/ # matching.js (auto-matching), activityLog.js (audit trail)
|
||||
│ ├── middleware/ # auth.js, admin.js (requireAdmin)
|
||||
│ ├── socket/ # Socket.IO handlers (chat, WebRTC, admin logs)
|
||||
│ ├── utils/ # request.js (IP extraction)
|
||||
│ ├── constants/ # Status constants
|
||||
│ └── __tests__/ # Jest tests (342 tests - 100% passing)
|
||||
│ ├── matching-algorithm.test.js # 19 tests
|
||||
@@ -77,10 +81,10 @@
|
||||
|
||||
---
|
||||
|
||||
## Database Schema (11 tables)
|
||||
## Database Schema (12 tables)
|
||||
|
||||
Key models:
|
||||
- `users` - Auth, profile, social links, location, lockout fields
|
||||
- `users` - Auth, profile, social links, location, lockout fields, `isAdmin` flag
|
||||
- Account tiers: `accountTier` (BASIC/SUPPORTER/COMFORT), `recordingsDone`, `recordingsReceived`
|
||||
- `events` - Dance events with unique slugs
|
||||
- `event_participants` - User-event relationship, competitorNumber, recorderOptOut, `accountTierOverride`
|
||||
@@ -90,33 +94,37 @@ Key models:
|
||||
- `recording_suggestions` - Auto-matching results with collision detection, `originRunId` tracking
|
||||
- `matching_runs` - Audit trail (manual/scheduler, status, stats)
|
||||
- `chat_rooms` / `messages` - Real-time chat persistence
|
||||
- `activity_logs` - Comprehensive audit trail (18 action types, indexed for performance)
|
||||
|
||||
---
|
||||
|
||||
## Recent Changes (Last 2 Days)
|
||||
## Recent Changes (2025-12-02)
|
||||
|
||||
### Matching Runs Audit System
|
||||
- **File:** `backend/src/__tests__/matching-runs-audit.test.js` (6 tests)
|
||||
- **Features:**
|
||||
- origin_run_id assignment and tracking
|
||||
- Sequential runs create separate audit records
|
||||
- Accepted suggestions preserve origin_run_id across re-runs
|
||||
- Admin endpoints with filtering (onlyAssigned, includeNotFound)
|
||||
- Manual vs scheduler trigger differentiation
|
||||
### Activity Log System (Phase 3.5) - Complete ✅
|
||||
**Comprehensive admin monitoring with real-time streaming dashboard**
|
||||
|
||||
### Ratings & Stats Integration
|
||||
- **File:** `backend/src/__tests__/ratings-stats-flow.test.js` (9 tests)
|
||||
- **Features:**
|
||||
- Atomic stats updates (recordingsDone, recordingsReceived)
|
||||
- Race condition prevention with `statsApplied` flag
|
||||
- Source filtering (only auto matches update stats)
|
||||
- Idempotency (double-rating prevention)
|
||||
- E2E double-rating completion flow
|
||||
**Backend (Phases 1-5):**
|
||||
- `activity_logs` table with 18 action types (AUTH_*, EVENT_*, MATCH_*, ADMIN_*, CHAT_*)
|
||||
- `activityLog.js` service - fire-and-forget logging, never blocks requests
|
||||
- `requireAdmin` middleware - fresh DB check for admin status
|
||||
- 3 API endpoints: query logs, get action types, get statistics
|
||||
- Socket.IO streaming - `admin_activity_logs` room with permission check
|
||||
- 14 integration points across auth, events, matches, socket handlers
|
||||
|
||||
### Documentation
|
||||
- **Updated:** README.md with current test statistics (342/342)
|
||||
- **New:** docs/TESTING_MATCHING_RATINGS.md (comprehensive 45-test overview)
|
||||
- **Archived:** Outdated quick start guides
|
||||
**Frontend (Phases 6-7):**
|
||||
- `ActivityLogsPage.jsx` (600+ lines) - full admin dashboard
|
||||
- Stats dashboard: total logs, unique users, failures, 24h activity
|
||||
- Advanced filtering: date range, category, action type, username, success/failure
|
||||
- Paginated table (50 per page) with color-coded action badges
|
||||
- Real-time streaming toggle (Socket.IO integration)
|
||||
- Admin-only route `/admin/activity-logs` with Shield icon in navbar
|
||||
|
||||
**Files Created/Modified:**
|
||||
- Backend: `schema.prisma`, `activityLog.js`, `admin.js`, `request.js`, admin routes
|
||||
- Frontend: `ActivityLogsPage.jsx`, `api.js`, `App.jsx`, `Navbar.jsx`
|
||||
- Integration: 14 logging points in auth, events, matches, socket handlers
|
||||
|
||||
**Admin User:** spotlight@radziel.com / Dance123!
|
||||
|
||||
---
|
||||
|
||||
@@ -221,4 +229,4 @@ REST_BUFFER_MINUTES: 60
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2025-11-30
|
||||
**Last Updated:** 2025-12-02
|
||||
|
||||
Reference in New Issue
Block a user