-
Notifications
You must be signed in to change notification settings - Fork 425
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
C22_Phoenix_Amber & Sphinx_Rong #64
base: main
Are you sure you want to change the base?
Conversation
Added an endpoint to return a lis of all planet_routes
Created endpoints for a specific planet and handled errors for non-integer input and invalid integers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on Waves 1 and 2! Your project directory is correctly organized and your model/routes look good!
Add create_new_planet() and get_all_planets() with their corresponding routes and HTTP methods. Additonally created get_one_planet()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
||
@planets_bp.get("") | ||
def get_all_planets(): | ||
all_params = request.args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also call all_params
something like query_params
planet.name = request_body['name'] | ||
planet.description = request_body['description'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a PUT route, I'd expect to see a way to update the rest of this model's attributes (size, moons, has_flag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
query = query.filter(Planet.moons >= all_params.get("moons")) | ||
|
||
if all_params.get("has_flag"): | ||
query =query.where(Planet.has_flag == all_params.get("has_flag")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query =query.where(Planet.has_flag == all_params.get("has_flag")) | |
query = query.where(Planet.has_flag == all_params.get("has_flag")) |
|
||
planets = db.session.scalars(query) | ||
|
||
response_body=[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response_body=[] | |
response_body = [] |
No description provided.