Skip to content

[Backend] Add pagination to GET /v1/users/:publicKey/events #506

@ogazboiz

Description

@ogazboiz

Telegram: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

getUserEvents in backend/src/controllers/user.controller.ts (lines ~70-96) does an unbounded prisma.streamEvent.findMany({ where: { stream: { OR: [...] } }, orderBy, include: { stream: true } }) with no take/skip. For an active wallet this returns every event ever, growing without bound and risking slow responses and large payloads. fetchUserEvents in frontend/src/lib/dashboard.ts (used by components/Dashboard.tsx) consumes this endpoint, so the dashboard pays the full cost.

The per-stream events endpoint (#364) and the per-wallet /v1/events endpoint are already paginated; this user-events endpoint was missed.

Acceptance criteria

  • Add limit (default e.g. 50, capped e.g. 200) and offset/page query params.
  • Return a paginated envelope consistent with the other endpoints ({ data/events, total, hasMore }).
  • Keep reverse-chronological ordering.
  • Update the Swagger block on the route.

Files to touch

  • backend/src/controllers/user.controller.ts
  • backend/src/routes/v1/user.routes.ts

Out of scope

  • Changing how the frontend Dashboard consumes it (can be a follow-up if needed).

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasksenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions