Skip to content

Conversation

@davidgamez
Copy link
Member

Summary:

This pull request introduces improvements to GTFS feed creation and related tests, along with a database migration to fix a default value issue. The main changes include refreshing the materialized view after creating new feeds, updating tests to mock this refresh, and correcting the default value for the created_at column in the Feed table.

Expected behavior:

  • The created_at column is defaulted toNOW
  • After feed creation in the operations API, the materialized view is refreshed

Testing tips:

Local testing

  • Update your local DB
  • Start the operations API
  • Hit the endpoint with the following request
curl --request POST \
  --url http://localhost:8080/v1/operations/feeds/gtfs \
  --header 'content-type: application/json' \
  --data '{
  "status": "active",
  "external_ids": [
    {
      "external_id": "1210  ",
      "source": "mdb "
    }
  ],
  "provider": "Los Angeles Department of Transportation (LADOT, DASH, Commuter Express)    ",
  "feed_name": "Bus",
  "note": "string",
  "feed_contact_email": "[email protected] ",
  "source_info": {
    "producer_url": "https://ladotbus.com/gtfs12?",
    "authentication_type": 2,
    "authentication_info_url": "https://apidevelopers.ladottransit.com",
    "api_key_parameter_name": "Ocp-Apim-Subscription-Key",
    "license_url": "https://www.ladottransit.com/dla.html"
  },
  "redirects": [
    {
      "target_id": "mdb-10",
      "comment": "Redirected because of a change of URL."
    }
  ],
  "operational_status": "published",
  "official": true,
  "related_links": [
    {
      "code": "next_1",
      "description": "The next",
      "url": "https://the.next.org"
    }
  ],
  "locations": [
    {
      "country_code": "US",
      "country": "United States",
      "subdivision_name": "California",
      "municipality": "Angeles"
    }
  ],
  "entity_types": ["sa", "vp"]
}'
  • Expect a response with the newly created information and create_at set to the current datetime.
  • Expect the materialized view to be refreshed
  • If the operation is repeated with the same request, the creation of the feed is rejected as the producer's URL matches

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@davidgamez davidgamez marked this pull request as ready for review November 18, 2025 20:59
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.

2 participants