Skip to content

(Task 5) Feature: sports service - #5

Open
Cuttsy27 wants to merge 1 commit into
feature/get-race-by-idfrom
feature/sports-service
Open

Cuttsy27 wants to merge 1 commit into
feature/get-race-by-idfrom
feature/sports-service

Conversation

@Cuttsy27

@Cuttsy27 Cuttsy27 commented Aug 4, 2025

Copy link
Copy Markdown
Owner

Changes

  • Used the racing service as a base to create new sports service
  • added Event item to database with properties: id, name, sport, visible, advertised_start_time
  • added ListEvents and GetEvent RPCs
  • Modified ListEvents (compared to racing) to be a GET request with query params for filtering, as recommended by Google AIP-132,AIP-160.
  • Refactored applyFilter method (compared to racing) to handle filter as a string, check for valid filter properties, then build clauses and args for final query

Summary

The new sports service runs independently of the racing service. It provides a way for users to get events and optionally filter by sport (Soccer, Basketball, etc) or by visible state, and order by advertised_start_time. The RPCs and repo methods are named as ListEvents and GetEvent to better allow for other resources to be added under sports later (replaced just List and Get compared to the racing service).
The ListEvents RPC uses a GET HTTP request to /v1/events with optional query param filter string which better follows Google's AIP-132 and AIP-160, compared to the racing service which uses a POST request to /v1/list-races and uses the request body to provide filtering.

Example

curl 'http://localhost:8000/v1/events?filter=sport%20in%20(%22Soccer%22%2C%20%22Basketball%22)&order_by=advertised_start_time%20desc'

Without encoding:

curl 'http://localhost:8000/v1/events?filter=sport in ("Soccer", "Basketball")&order_by=advertised_start_time desc'

Tests

  • all tests are based on those in the racing service, plus refactoring to account for changes to filter

@Cuttsy27 Cuttsy27 changed the title Feature: Sports Service Feature: sports service Aug 4, 2025
@Cuttsy27 Cuttsy27 changed the title Feature: sports service (Task 5) Feature: sports service Aug 4, 2025
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