Skip to content

add sort by advertised_start_time#2

Open
benrobey wants to merge 1 commit intostep1-visible-filter-and-depsfrom
step2-ordering
Open

add sort by advertised_start_time#2
benrobey wants to merge 1 commit intostep1-visible-filter-and-depsfrom
step2-ordering

Conversation

@benrobey
Copy link
Owner

@benrobey benrobey commented Aug 17, 2025

Step 2: Order Races by Advertised Start Time

Results are now always ordered by advertised_start_time ascending (earliest first) by default. You can reverse the order with sort_direction.

Field: filter.sort_direction (enum, optional)

Values:

  • SORT_DIRECTION_UNSPECIFIED (or omitted) → ascending (earliest to latest)
  • SORT_DIRECTION_ASC → ascending
  • SORT_DIRECTION_DESC → descending (latest to earliest)

Example – Default ordering (ascending)

curl -s -X POST http://localhost:8000/v1/list-races \
	-H "Content-Type: application/json" \   
	-d '{}'

No sort_direction provided → ascending order.

Example – Explicit descending order

curl -s -X POST http://localhost:8000/v1/list-races \
	-H "Content-Type: application/json" \
	-d '{"filter":{"sort_direction":"SORT_DIRECTION_DESC"}}'

Returns the most recently scheduled (or already started) races first.

Combine ordering with visibility:

curl -s -X POST http://localhost:8000/v1/list-races \
	-H "Content-Type: application/json" \
	-d '{"filter":{"visible_only":true, "sort_direction":"SORT_DIRECTION_ASC"}}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant