Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ad158b5
aggrement
hintow Oct 18, 2024
597d34c
"added signature to coworking_agreement"
beenishali693 Oct 18, 2024
cb8eb34
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
beenishali693 Oct 18, 2024
f1433e4
draft wave 1&2
hintow Oct 18, 2024
9856a3f
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
hintow Oct 18, 2024
c02f9bf
draft 2
hintow Oct 18, 2024
dc1f1fa
"End of Wave 1"
beenishali693 Oct 18, 2024
968179e
End of wave 1
beenishali693 Oct 18, 2024
c9c7631
rename planets to planet
hintow Oct 21, 2024
93abc66
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
hintow Oct 21, 2024
9e3d33e
Wave 2 completed
beenishali693 Oct 21, 2024
65111b2
moved to_dict to planets file
beenishali693 Oct 21, 2024
2c4dedc
merge wave2
hintow Oct 24, 2024
5310ed1
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
hintow Oct 24, 2024
a8a5c53
solve to_dict problem
hintow Oct 24, 2024
b11ec73
200 response code
hintow Oct 24, 2024
0fdc1a2
finished with wave 3
beenishali693 Oct 28, 2024
5dee1a8
get one planet
hintow Oct 29, 2024
e949917
added get_one_planet, update and delete routes
beenishali693 Oct 29, 2024
69d4628
wave4
hintow Oct 29, 2024
49c96a6
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
hintow Oct 29, 2024
fc70d52
wave 5
hintow Oct 30, 2024
410610c
added seed.py
beenishali693 Oct 31, 2024
d49aaed
added a count parameter
beenishali693 Oct 31, 2024
85cd85d
wave 6
hintow Oct 31, 2024
5f2e3af
end of wave 6
beenishali693 Oct 31, 2024
5d3a50a
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
hintow Oct 31, 2024
c63548a
Merge branch 'main' of https://github.com/beenishali693/solar-system-api
beenishali693 Oct 31, 2024
411075f
minor changes
beenishali693 Oct 31, 2024
d0c56c7
fixed delete test to also check the count
beenishali693 Oct 31, 2024
e611944
added test on learn
beenishali693 Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from flask import Flask
from .routes.planet_routes import planets_bp


def create_app(test_config=None):
app = Flask(__name__)

app.register_blueprint(planets_bp)
return app
Empty file added app/models/__init__.py
Empty file.
29 changes: 29 additions & 0 deletions app/models/planet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from flask import Flask

class Planet:

def __init__(self,id,name,description,galaxy):

Choose a reason for hiding this comment

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

Nit: include a space after commas in parameters

    def __init__(self, id, name, description, galaxy):

Choose a reason for hiding this comment

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

Looking at your data, consider setting a default value for the galaxy parameter.

    def __init__(self, id, name, description, galaxy="Milky Way"):

self.id = id
self.name = name
self.description = description
self.galaxy = galaxy

def to_dict(self):

Choose a reason for hiding this comment

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

👍 Nice job incorporating this refactor from the live code.

return {
"id": self.id,
"name": self.name,
"description": self.description,
"galaxy": self.galaxy
}
Comment on lines +11 to +16

Choose a reason for hiding this comment

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

Personally, I prefer to stick with uniform 4-space indented wrapping rather than trying to align to the enclosing character. Generally the closing brace should align with either the first line (pre-indent), or the content lines (1-level indent). As written, it's a bit floaty.

        return {
            "id": self.id,
            "name": self.name,
            "description": self.description,
            "galaxy": self.galaxy
        }



mercury = Planet(1,"Mercury","first planet from the sun","Milkyway")

Choose a reason for hiding this comment

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

👀 Space after argument commas here and throughout.

mercury = Planet(1, "Mercury", "first planet from the sun", "Milkyway")

venus = Planet(2,"Venus","second planet from the sun, hottest planet","Milkyway")
earth = Planet(3,"Earth","HOME PLANET","Milkyway")
mars = Planet(4,"Mars","has the highest mountain","Milkyway")
jupiter = Planet(5,"Jupiter","has many moons","Milkyway")
saturn = Planet(6,"Saturn","has many rings","Milkyway")
uranus = Planet(7,"Uranus"," the coldest planet in our Solar System","Milkyway")
neptune = Planet(8,"Neptune","the farthest planet from the Sun","Milkyway")

planets = [mercury, venus, earth, mars, jupiter, saturn, uranus, neptune]
2 changes: 0 additions & 2 deletions app/routes.py

This file was deleted.

1 change: 1 addition & 0 deletions app/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

31 changes: 31 additions & 0 deletions app/routes/planet_routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from flask import Blueprint, make_response, abort
from ..models.planet import planets

Choose a reason for hiding this comment

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

👍 Nice relative import.


planets_bp = Blueprint("planets_bp",__name__,url_prefix="/planets")

Choose a reason for hiding this comment

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

👀 Spaces after argument commas.

planets_bp = Blueprint("planets_bp", __name__, url_prefix="/planets")


@planets_bp.get("")
def get_all_planets():
planets_response = []
for planet in planets:
planets_response.append(planet.to_dict())
Comment on lines +38 to +40

Choose a reason for hiding this comment

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

There's a great opportunity to try to use a list comprehension here.

    planets_response = [planet.to_dict() for planet in planets]

return planets_response

@planets_bp.get("/<planet_id>")
def get_one_planet(planet_id):
planet = validate_planet(planet_id)
return planet.to_dict(),200

Choose a reason for hiding this comment

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

The status code will be 200 by default, so we can leave that off.

    return planet.to_dict()



def validate_planet(planet_id):
try:
planet_id = int(planet_id)
except:
response = {"message": f"{planet_id} is not valid"}
abort(make_response(response, 400))

for planet in planets:
if planet_id == planet.id:
return planet

response = {"message": f"{planet_id} is not found"}
abort(make_response(response, 404))
13 changes: 12 additions & 1 deletion coworking_agreement.md

Choose a reason for hiding this comment

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

Nice to see that you discussed your coworking needs and preferences!

Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,32 @@ Talk through each section with your partner. Add notes on what you discussed and
## Accessibility Needs
*What does each team member need access to in order to succeed and show up the best they can?*


Flexibility and schedule.

## Collaboration vs. individual work expectations
*Clarify your collaboration expectations- does your group want to write code together all of the time? Or divide work to do independently, then come together to share accomplishments? What tools and technologies can help your collaboration?*
Group work & indepent work for best practice.

## Learning Style
*How does each team member learn best in project settings?*

Practicing

## Preferred Feedback Style
*How does each team member best receive feedback?*

Open to feedback. Meetings/slack

## One Team Communication Skill to Improve
*What is a teamwork-related skill you want to work on?*
Communication skill

## Optional: Other agreements
*Other co-working agreements that were not captured in the above sections.*

## Signatures
______________ _______________
______________ _____Wei Qiang__________
Date: ___2024/10/18______
_Beenish Ali____________ _______________
Date: _________