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

Sphinx + Phoenix - Sarah K., Charday N., & Priyanka K. #66

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

skoch-neat
Copy link

No description provided.

skoch-neat and others added 2 commits October 18, 2024 11:54
…efined Planet class and hardcoded a list of instances, and created an endpoint to get all existing planets.

Co-authored-by: Charday Neal <[email protected]>
Copy link
Contributor

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice job on Waves 1 and 2 so far! The code looks good!

I did leave a few comments about the project structure and how it should be reorganized. Let me know if you have any questions!

app/routes.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though we only have one model, planets, we'll still want a directory called "routes" and this file would nest under that directory and should be renamed planet_routes.py

Consider making this change before starting on Wave 3!

app/__init__.py Outdated
@@ -1,7 +1,10 @@
from flask import Flask
from .routes import planets_bp
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment in routes.py first, how would this import statement need to change if your route file was named planet_routes.py and was in a "routes" directory?

app/planets.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though we only have one model, planets, we'll still want a directory called "models" and this file would nest under that directory.

Soon you'll be working with APIs that have multiple models and each model will have specific routes so organizing your project accordingly makes it easier to navigate.

Consider making this change before starting on Wave 3!

Also, since the class name is singular, I'd expect that the file name would match the class name so planets.py would be called planet.py

requirements.txt Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Did dependencies get updated? Do we need to be tracking these changes in the requirements.txt? Maybe i missed something since I wasn't in the round table, but I wouldn't expect needing to make changes to this file.

Copy link
Author

Choose a reason for hiding this comment

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

We both had some issues installing Flask, but we didn't intend to make any changes to the requirements.txt (and also missed that this was included in the commit). We'll revert the changes with the next push.

@skoch-neat skoch-neat changed the title Sphinx + Phoenix - Sarah K. + Charday N. Sphinx + Phoenix - Sarah K., Charday N., & Priyanka K. Oct 26, 2024
skoch-neat and others added 8 commits October 28, 2024 16:21
… to use absolute imports. Reorganized import statements, grouped by source and sorted alphabetically within groups. Removed old, unused code. Ensured consistency in the use of single and double quotes in strings.
…and delete a planet.

Co-authored-by: Pri <[email protected]>
Co-authored-by: Charday Neal <[email protected]>
"Add wave 6 fixtures and pytest to validate get one planet-found, get one planet-not found, get all planet-empty-db, get all planet- db has 2 entries, post one planet. Add two_saved_planets to database."
…y. Added helper functions to get query parameters from the client request, filter the query based on the client parameters, sort the response body by a client-supplied parameter, and supporting validation for data processed.
Copy link
Contributor

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Let me know if you have questions about my comments! Nice job on solar-system!

constants.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +61 to +62
if params[ID]:
query = query.where(Planet.id == validate_cast_type(params[ID], int, ID))
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm understanding correctly, this handles a scenario where someone makes a GET requets to /planets and could pass along query param like ?id=1. Then you'd "filter", query for record with id 1. Is that right?

If that's the case, we duplicate functionality because your GET /planets/id already achieves this and also follows convention. I'd prefer getting rid of this filtering logic since it's duplicating what you already have.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe renaming the function to validate_and_cast_value would be a little more descriptive because your function does more than validating. If all goes according to plan, it will return a new type for the value passed in.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

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.

4 participants