feat: Implement centralized audit logging admin interface (refs #10)
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 4m42s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 37s
Deploy to Staging / Verify Staging (pull_request) Failing after 6s
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 6s
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 4m42s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 37s
Deploy to Staging / Verify Staging (pull_request) Failing after 6s
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 6s
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,9 @@ import {
|
||||
UpdateScheduleRequest,
|
||||
RestorePreviewResponse,
|
||||
ExecuteRestoreRequest,
|
||||
// Unified Audit Log types
|
||||
UnifiedAuditLogsResponse,
|
||||
AuditLogFilters,
|
||||
} from '../types/admin.types';
|
||||
|
||||
export interface AuditLogsResponse {
|
||||
@@ -507,4 +510,36 @@ export const adminApi = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Unified Audit Logs (new centralized audit system)
|
||||
unifiedAuditLogs: {
|
||||
list: async (filters: AuditLogFilters = {}): Promise<UnifiedAuditLogsResponse> => {
|
||||
const params: Record<string, string | number> = {};
|
||||
if (filters.search) params.search = filters.search;
|
||||
if (filters.category) params.category = filters.category;
|
||||
if (filters.severity) params.severity = filters.severity;
|
||||
if (filters.startDate) params.startDate = filters.startDate;
|
||||
if (filters.endDate) params.endDate = filters.endDate;
|
||||
if (filters.limit) params.limit = filters.limit;
|
||||
if (filters.offset) params.offset = filters.offset;
|
||||
|
||||
const response = await apiClient.get<UnifiedAuditLogsResponse>('/admin/audit-logs', { params });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
export: async (filters: AuditLogFilters = {}): Promise<Blob> => {
|
||||
const params: Record<string, string | number> = {};
|
||||
if (filters.search) params.search = filters.search;
|
||||
if (filters.category) params.category = filters.category;
|
||||
if (filters.severity) params.severity = filters.severity;
|
||||
if (filters.startDate) params.startDate = filters.startDate;
|
||||
if (filters.endDate) params.endDate = filters.endDate;
|
||||
|
||||
const response = await apiClient.get('/admin/audit-logs/export', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user