audius-protocol
audius-protocol copied to clipboard
Update playlists full get endpoint to retrieve playlist by playlist id or permalink
Description
This diff updates the playlists full get() endpoint to retrieve playlist by playlist_id or permalink. This means playlist_id is no longer a required param and is passed as a query param with permalink. This updates the endpoint and the get_playlists query to consider a route object containing handle and slug, as part of the project to remove playlist ids from urls. This was only added to the full endpoint since I figured this will only be used internally and we don't want to break any api users' existing uses of this endpoint (but lmk your thoughts on this! not sure if there is danger deploying a change to the endpoint's route)
Changes:
- Update populate_mock_db to create playlistRoutes
- Refactor the get_playlists query and move inner function to private function
- Add a case for handling routes in the get_playlists query
- Adding tests for the get_playlists query
Tests
added unit tests for get_playlists
test-discovery is failing because:
discovery-provider/src/queries/get_playlists.py:146:16: error: Module has no attribute "exc"
which is from this line in get_playlists except sqlalchemy.orm.exc.NoResultFound:
. This was existing code and an existing import that i did not touch... any ideas why this may be failing?
sqlalchemy.orm.exc.NoResultFound
maybe the test didn't throw an exception until now?
it's failing on python lint so i guess it's possible the linter didn't exist the first time around it was used.. is there another way to import a NoResultFound exception?