Conversation
spitsfire
left a comment
There was a problem hiding this comment.
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.
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.
Agree, should be deleted from init.py
| @@ -0,0 +1,15 @@ | |||
| from flask import abort, make_response | |||
There was a problem hiding this comment.
👍 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.
| # 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 | |
| # } |
| "moons": self.moons | ||
| } | ||
|
|
||
| def update(self, req_body): |
| 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.
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.
any reason you removed the status code on line 42?
There was a problem hiding this comment.
I think no. I am not sure why we removed it.
| @@ -0,0 +1,42 @@ | |||
| import pytest | |||
| @@ -0,0 +1,45 @@ | |||
| def test_get_all_planets_with_no_records(client): | |||
No description provided.