Skip to content

C22_Phoenix_Amber & Sphinx_Rong#64

Open
cornetto9 wants to merge 11 commits intoAdaGold:mainfrom
Msambere:main
Open

C22_Phoenix_Amber & Sphinx_Rong#64
cornetto9 wants to merge 11 commits intoAdaGold:mainfrom
Msambere:main

Conversation

@cornetto9
Copy link
Copy Markdown

No description provided.

Msambere and others added 3 commits October 18, 2024 13:37
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.
Copy link
Copy Markdown
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 work on Waves 1 and 2! Your project directory is correctly organized and your model/routes look good!

Copy link
Copy Markdown
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.

Looks good!


@planets_bp.get("")
def get_all_planets():
all_params = request.args
Copy link
Copy Markdown
Contributor

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

Comment on lines +91 to +92
planet.name = request_body['name']
planet.description = request_body['description']
Copy link
Copy Markdown
Contributor

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)

Comment thread tests/conftest.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

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"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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=[]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
response_body=[]
response_body = []

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.

3 participants