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_recordtoprofile.summary.edits - Removed the following unused endpoints from
app/api/v1/endpoints/users.py:GET /users/{id}/edit-activityGET /users/{id}/edit-metricsGET /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_recordwas 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=summaryreturnsaverage_edits_per_record -
GET /users/{id}/edit-activityreturns 404 -
GET /users/{id}/edit-metricsreturns 404 -
GET /users/{id}/activity-summaryreturns 404 -
No import or schema errors -
Existing profile UI still works