Skip to content

refactor: Consolidate users analytis endpoints to profile.summary

MR: User Analytics API Cleanup

Summary

This MR removes three unused user analytics endpoints and consolidates the remaining profile summary data into /users/{id}/profile?include=summary by adding the missing average_edits_per_record field.

What Changed

Backend

  • Added average_edits_per_record to profile.summary.edits
  • Removed the following unused endpoints from app/api/v1/endpoints/users.py:
    • GET /users/{id}/edit-activity
    • GET /users/{id}/edit-metrics
    • GET /users/{id}/activity-summary
  • Removed unused imports from users.py
  • Removed obsolete schema exports from app/schemas/__init__.py
  • Deleted dead schema classes from app/schemas/record_history.py

Why

  • The frontend only uses profile.summary.edits.total_edits
  • The profile summary already provides the same analytics data as the removed endpoints
  • average_edits_per_record was the only missing field
  • This reduces dead code and simplifies the API surface

Impact

  • No frontend changes required
  • No data loss
  • One additive field in the profile summary
  • Three unused endpoints removed

Verification

  • GET /users/{id}/profile?include=summary returns average_edits_per_record
  • GET /users/{id}/edit-activity returns 404
  • GET /users/{id}/edit-metrics returns 404
  • GET /users/{id}/activity-summary returns 404
  • No import or schema errors
  • Existing profile UI still works

Merge request reports

Loading