Skip to content

Tien&Anya - Sharks Solar_system#27

Open
AnnnAPr wants to merge 19 commits intoada-c17:mainfrom
AnnnAPr:main
Open

Tien&Anya - Sharks Solar_system#27
AnnnAPr wants to merge 19 commits intoada-c17:mainfrom
AnnnAPr:main

Conversation

@AnnnAPr
Copy link
Copy Markdown

@AnnnAPr AnnnAPr commented May 2, 2022

No description provided.

Copy link
Copy Markdown

@spitsfire spitsfire left a 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!

Comment thread app/__init__.py
Comment on lines +14 to +15
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://postgres:postgres@localhost:5432/solar_system_development'
Copy link
Copy Markdown

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

Suggested change
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://postgres:postgres@localhost:5432/solar_system_development'

Copy link
Copy Markdown
Author

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

Comment thread app/helper.py
@@ -0,0 +1,15 @@
from flask import abort, make_response
Copy link
Copy Markdown

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!

Comment thread app/models/planet.py
Comment on lines +34 to +47
# 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
# }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
# 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
# }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Forgot delete those lines

Comment thread app/models/planet.py
"moons": self.moons
}

def update(self, req_body):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 helper method woo

Comment thread app/routes.py
db.session.add(new_planet)
db.session.commit()

# return make_response(jsonify(f"Planet {new_planet.name} successfully created!", 201))
Copy link
Copy Markdown

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

Suggested change
# return make_response(jsonify(f"Planet {new_planet.name} successfully created!", 201))

Comment thread app/routes.py
Comment on lines +41 to +42
# return jsonify(planet.to_json()), 200
return jsonify(planet.to_json())
Copy link
Copy Markdown

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?

Copy link
Copy Markdown
Author

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.

Comment thread app/tests/conftest.py
@@ -0,0 +1,42 @@
import pytest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 looks good

Comment thread app/tests/test_routes.py
@@ -0,0 +1,45 @@
def test_get_all_planets_with_no_records(client):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 looks good

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