Skip to content

Audit API ​

Implementation: front/src/services/api/auditService.ts; page caller: front/src/pages/AuditTrails.tsx.

GET /audit ​

  • Called when: Audit Trails mounts or page/action/user/date filters change.
  • Query: optional search, action, user, dateRange, startDate, endDate, page, limit. The page sends action/user/date/page and limit 50; search is applied client-side on fetched entries.
  • Response expected: success, data array, and optional pagination with page/limit/total/totalPages. Service maps to entries/total/page/limit/totalPages.
  • Failure: logs and returns an empty audit result with default pagination. Page clears entries and logs failure.
  • Example: GET {VITE_API_BASE_URL}/audit?page=1&limit=50

GET /audit/:id ​

  • Called from: getAuditEntryById; no page call confirmed in reviewed sources.
  • Path: id string.
  • Response expected: success, data: AuditEntry.
  • Failure: logs and returns null.
  • Example: GET {VITE_API_BASE_URL}/audit/{id}

GET /audit/export ​

  • Called from: exportAuditLog; page call site not confirmed from the inspected source.
  • Query: optional search/action/user/dateRange/startDate/endDate.
  • Response: blob with application/octet-stream.
  • Failure: logs and throws.
  • Example: GET {VITE_API_BASE_URL}/audit/export

GET /audit/summary ​

  • Called when: Audit Trails mounts and its page/action/user/date effect reruns.
  • Response fields mapped: totalEntries, uniqueUsers, recentActivity, criticalActions; absent values default to zero in service.
  • Failure: logs and returns zero values.
  • Example: GET {VITE_API_BASE_URL}/audit/summary

Audit entry backend schema, auth enforcement, and non-401 error responses are not available from frontend source code. Backend/API contract verification required.