Skip to content

[Backend] Add event listing and team listing endpoints with pagination #421

@Pcmhacker-piro

Description

@Pcmhacker-piro

Summary

Allows users to browse public events and their teams, filling a gap where events and teams can be created but never listed.

Contexts

Events have POST /, GET /:slug, POST /:slug/join, DELETE /:slug/leave, GET /:slug/attendees — but no GET / to list events. Teams similarly lack a list endpoint. The analytics /views endpoint (analytics.ts:90-159) already demonstrates the pagination pattern ({ data, meta: { page, limit, total, totalPages } }).

Tasks

  • Add GET /api/events listing public events with page and limit query params, sorted by startDate
  • Add GET /api/teams listing teams the authenticated user belongs to, with pagination
  • Use consistent response shape: { data: [...], meta: { page, limit, total, totalPages } }
  • Add Zod validation for query params
  • Write tests in event.test.ts and team.test.ts

Acceptance Criteria

  • GET /api/events returns paginated public events
  • GET /api/teams returns paginated teams for the authenticated user
  • Pagination meta is correct (page, limit, total, totalPages)
  • Invalid page/limit values return 400
  • Tests cover pagination edge cases (empty results, last page, out-of-range page)

Area

backend

Difficulty

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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