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

Snow Leopards - Anika & Annie #28

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

Conversation

anniegallagher
Copy link

No description provided.

Copy link

@marciaga marciaga left a comment

Choose a reason for hiding this comment

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

Great start!

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String, nullable=False)
description = db.Column(db.String, nullable=False)
moons = db.Column(db.Integer, nullable=False)

Choose a reason for hiding this comment

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

Is the idea here that even if some planet has no moons, we're still requiring 0 be added to the database? Totally fine decision! Someone might also say "let it be nullable and then querying the db for planets with no moons can check for null instead of 0". I could see either being compelling. If you think about what kinda of application might submit this data, say, from a "add a new planet" form on a web site, if you make the db field non-nullable, then the client would have to account for adding the 0 to the form data for planets with no moons, or, the server-side code would have to check for a moons value and add the 0 if there isn't such a value. Interesting food for thought.

@planets_bp.route("", methods=["GET"])
def read_all_planets():
planets = Planet.query.all()
planets_response = [planet.to_dict() for planet in planets]

Choose a reason for hiding this comment

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

👍🏽

app/routes.py Outdated
planets_response = [planet.to_dict() for planet in planets]
return jsonify(planets_response)

# @planets_bp.route("", methods=["GET"])

Choose a reason for hiding this comment

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

Probably safe to omit commented out code from commits.

Copy link

@marciaga marciaga left a comment

Choose a reason for hiding this comment

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

Great job overall! Routes, model, and tests were well-structured 👍🏽

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