Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Feed Search endpoint is returning DB id instead of feed.stable_id for feed_references field #392

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

davidgamez
Copy link
Member

@davidgamez davidgamez commented Apr 18, 2024

Summary:

Update the FeedSearch view by replacing the internal feed ID with the stable feed ID.

Closes #389

Expected behavior:

The feed_references field is populated with stable ids. Find a snipped of a local response below,

        {
            "id": "mdb-1628",
            "data_type": "gtfs_rt",
            "status": "active",
............

            "feed_references": [
                "mdb-510"
            ]
        },

Testing tips:

  • Checkout the branch
  • Execute(**Warning your local database content will be deleted),
./scripts/docker-localdb-rebuild-data.sh --populate-db
  • Execute,
./scripts/api-start.sh
  • Test the search endpoints filtering by gtfs_rt feeds. Example curl command,
curl --location 'http://localhost:8080/v1/search?search_query=New%20York&offset=10&limit=5&status=active&data_type=gtfs_rt' \
--header 'Accept: application/json'
  • Verify that stable IDs in the form mdb-## are present in the feed_references arrays.

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 April 18, 2024 21:18
Comment on lines +57 to +64
LEFT JOIN(
SELECT
gtfs_rt_feed_id,
array_agg(FeedReferenceJoinInnerQuery.stable_id) as feed_reference_ids
FROM FeedReference
LEFT JOIN Feed as FeedReferenceJoinInnerQuery on FeedReferenceJoinInnerQuery.id = FeedReference.gtfs_feed_id
GROUP BY gtfs_rt_feed_id
) AS FeedReferenceJoin ON FeedReferenceJoin.gtfs_rt_feed_id = Feed.id AND Feed.data_type = 'gtfs_rt'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the portion of the view that I modified. cc: @Alessandro100

Copy link
Contributor

@Alessandro100 Alessandro100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@davidgamez davidgamez merged commit c632472 into main Apr 19, 2024
2 checks passed
@davidgamez davidgamez deleted the fix/gtfs-reference-ids branch April 19, 2024 15:03
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.

Feed Search endpoint is returning DB id instead of feed.stable_id for feed_references field
2 participants