-
Notifications
You must be signed in to change notification settings - Fork 61
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
Tien&Anya - Sharks Solar_system #27
base: main
Are you sure you want to change the base?
Conversation
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.
Part 2! Great job, Tien and Anya! I didn't see any red flags or things I was concerned about!
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | ||
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://postgres:postgres@localhost:5432/solar_system_development' |
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 we now have this string stored in our environmental variables for safe keeping we want to get rid of it from public view
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | |
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://postgres:postgres@localhost:5432/solar_system_development' |
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.
Agree, should be deleted from init.py
@@ -0,0 +1,15 @@ | |||
from flask import abort, make_response |
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.
👍 Great job moving this helper function into a separate file, so that our routes are more clean and easy to read!
# class Planet(): | ||
# def __init__(self, id, name, description, moons = None): | ||
# self.id = id | ||
# self.name = name | ||
# self.description = description | ||
# self.moons = moons | ||
|
||
# def to_json(self): | ||
# return { | ||
# "id": self.id, | ||
# "name" : self.name, | ||
# "decription": self.description, | ||
# "moons": self.moons | ||
# } |
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.
# class Planet(): | |
# def __init__(self, id, name, description, moons = None): | |
# self.id = id | |
# self.name = name | |
# self.description = description | |
# self.moons = moons | |
# def to_json(self): | |
# return { | |
# "id": self.id, | |
# "name" : self.name, | |
# "decription": self.description, | |
# "moons": self.moons | |
# } |
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.
Forgot delete those lines
"moons": self.moons | ||
} | ||
|
||
def update(self, req_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.
👍 helper method woo
db.session.add(new_planet) | ||
db.session.commit() | ||
|
||
# return make_response(jsonify(f"Planet {new_planet.name} successfully created!", 201)) |
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.
This looks the same as the one below, so let's get rid of this
# return make_response(jsonify(f"Planet {new_planet.name} successfully created!", 201)) |
# return jsonify(planet.to_json()), 200 | ||
return jsonify(planet.to_json()) |
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.
any reason you removed the status code on line 42?
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.
I think no. I am not sure why we removed it.
@@ -0,0 +1,42 @@ | |||
import pytest |
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
@@ -0,0 +1,45 @@ | |||
def test_get_all_planets_with_no_records(client): |
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
No description provided.