Skip to content

GET /api/clubs endpoint #44

Description

@Sootopolis

Depends on

None.

Blocks

  • Shell completions (uses this as a club-slug source)

What

Lightweight endpoint returning every club slug in the local DB so the CLI can populate its completion cache.

Response shape:

{
  "clubs": [
    { "slug": "team-alpha", "name": "Team Alpha" }
  ]
}

Source: SELECT slug, name FROM club ORDER BY slug (or the closest existing Club.selectAll-style helper). Skip tombstoned _stale_<id> rows (see CLAUDE.md "Username and club-slug rename recovery").

Why

Completion source for Phase 1 (no auth yet). In Phase 2 this is replaced by /api/auth/me's managed_clubs[] so completion only suggests clubs the user can actually act on. This endpoint stays as a fallback or gets deprecated then — decision deferred to the Phase 2 auth epic.

Acceptance

  • curl localhost:8080/api/clubs returns a JSON list of {slug, name} in alphabetical order by slug.
  • Tombstoned clubs excluded.
  • Empty DB → empty list, 200 status.

Files

  • new src/main/scala/ccas/server/routes/ClubRoutes.scala
  • src/main/scala/ccas/server/CcasServer.scala — register route.

Reference

Tracked under epic #40 (CLI v0). Discussed in the planning thread; not yet written into the roadmap file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:serverBackend HTTP server, jobs, schedulerenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions