Skip to content

Add /analytics/users/retention endpoint #527

Description

@phertyameen

Description

Add a controller route GET /analytics/users/retention exposing the retention curve. Validate query params with a DTO (class-validator), guard the route with AnalyticsAdminGuard where the data is sensitive, and delegate the computation to get-retention-curve.provider.ts.

Why this matters

This is the API surface the analytics dashboard (frontend) and any external reporting tools will consume for 'the retention curve'.

Files to touch

  • backend/src/analytics/analytics.controller.ts
  • backend/src/analytics/providers/get-retention-curve.provider.ts
  • backend/src/analytics/dtos/analytics-query.dto.ts

Acceptance Criteria

  • GET /analytics/users/retention returns a 200 with the documented response shape
  • Invalid query params return a 400 with a clear validation message
  • Route is covered by an e2e test in backend/test/analytics.e2e-spec.ts

Notes

This issue is part of the new analytics module effort (tracking, aggregation,
and reporting on player/game activity). Please keep new code inside
backend/src/analytics/ following the same module/controller/service/provider
layout used by existing modules (e.g. progress, streak, quests).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions