feat(server): add GET /api/clubs endpoint (#44)#77
Merged
Merged
Conversation
Lightweight read-only endpoint listing every non-tombstoned club as
{slug, name}, alphabetical by slug, so the CLI can populate its
shell-completion cache. Tombstoned _stale_<id> rows are excluded.
Also collapse the route assembly in CcasServer from a long ++ chain
into a List(...).reduce(_ ++ _) so adding a route is a one-line change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a lightweight read-only
GET /api/clubsendpoint returning every non-tombstoned club as{slug, name}, alphabetical by slug:{ "clubs": [ { "slug": "team-alpha", "name": "Team Alpha" } ] }Source:
Club.selectAll, filtering_stale_<id>tombstone rows and sorting by slug. Reuses the existingRouteHelpers.jsonResponse/withErrorHandlingpattern (DBSQLException→ logged 500, matching the other routes). Empty DB →{"clubs":[]}, 200.Why
Completion-cache source for the CLI v0 epic (#40): the CLI writes the response to its
clubs.txtcache to driveccas <club> <TAB>completion. Unblocks #49 (shell completions). In Phase 2 this is superseded by/api/auth/me'smanaged_clubs[](#66) — deferred there.Also
Collapse the route assembly in
CcasServerfrom a long++chain into aList(...).reduce(_ ++ _)so adding a route is a one-line change; annotated with the combined env so a new route's deps surface at compile time.Tests
TestRoutesgains aClubRoutessub-suite: alphabetical ordering +_stale_exclusion (with self-cleaning fixture) and the{clubs:[{slug,name}]}wire shape. Full suite green locally (785/785).Closes #44.
Part of #40.