## Summary
- Implements new centralized `audit_logs` table with categories (auth, vehicle, user, system, admin) and severities (info, warning, error)
- Creates `AuditLogService` with cross-feature logging capability via singleton instance
- Adds REST API at `/api/admin/audit-logs` with search, filters, pagination, and CSV export
- Wires audit logging into auth, vehicles, admin, and backup features
- Adds desktop `AdminLogsPage` and mobile `AdminLogsMobileScreen`
- Implements 90-day retention with daily cleanup job (3 AM)
- Removes old `AuditLogPanel` from `AdminCatalogPage`
Security improvements:
- Escapes LIKE special characters to prevent pattern injection
- Limits CSV export to 5000 records with truncation warning headers
## Test plan
- [ ] Verify database migration runs successfully
- [ ] Test audit log creation from vehicle CRUD operations
- [ ] Test audit log creation from admin actions
- [ ] Test search and filter functionality on desktop
- [ ] Test mobile card layout and collapsible filters
- [ ] Test CSV export with various filter combinations
- [ ] Verify 90-day cleanup job runs without errors
- [ ] Confirm AuditLogPanel removed from Vehicle Catalog page
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Add audit_logs table with categories, severities, and indexes
- Create AuditLogService and AuditLogRepository
- Add REST API endpoints for viewing and exporting logs
- Wire audit logging into auth, vehicles, admin, and backup features
- Add desktop AdminLogsPage with filters and CSV export
- Add mobile AdminLogsMobileScreen with card layout
- Implement 90-day retention cleanup job
- Remove old AuditLogPanel from AdminCatalogPage
Security fixes:
- Escape LIKE special characters to prevent pattern injection
- Limit CSV export to 5000 records to prevent memory exhaustion
- Add truncation warning headers for large exports
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The old /api/admin/audit-logs route in admin.routes.ts conflicted with the
new centralized audit-log feature. Removed the old route since we're now
using the unified audit logging system.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The routes and screen components for AdminLogsPage were implemented but
the navigation links to access them were missing from both desktop and
mobile Settings pages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The audit_logs table migration was not being executed because the
audit-log feature was missing from MIGRATION_ORDER in run-all.ts,
causing 500 errors when accessing the audit logs API.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Backend:
- Add login event logging to getUserStatus() controller method
- Create POST /auth/track-logout endpoint for logout tracking
Frontend:
- Create useLogout hook that wraps Auth0 logout with audit tracking
- Update all logout locations to use the new hook (SettingsPage,
Layout, MobileSettingsScreen, useDeletion)
Login events are logged when the frontend calls /auth/user-status after
Auth0 callback. Logout events are logged via fire-and-forget call to
/auth/track-logout before Auth0 logout.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add userEmail field to AuditLogEntry type in backend and frontend
- Update audit-log repository to LEFT JOIN with user_profiles table
- Update AdminLogsPage to show email with fallback to truncated userId
- Update AdminLogsMobileScreen with same display logic
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
audit_logstable with categories (auth, vehicle, user, system, admin) and severities (info, warning, error)AuditLogServicewith cross-feature logging capability via singleton instance/api/admin/audit-logswith search, filters, pagination, and CSV exportAdminLogsPageand mobileAdminLogsMobileScreenAuditLogPanelfromAdminCatalogPageSecurity improvements:
Test plan
🤖 Generated with Claude Code