Skip to content

Commit

Permalink
fix: removing labels from JSON responses
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbpro committed Nov 14, 2020
1 parent 22d7f02 commit bb5304b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion resources/customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ def put(self):
# route: /customers
class CustomerList(Resource):
def get(self):
return {'Customers': [x.json() for x in CustomerModel.query.all()]}
return {[x.json() for x in CustomerModel.query.all()]}
4 changes: 2 additions & 2 deletions resources/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def post(self):
try:
order.save_to_db()
except:
return {"message": "An error occurred upon inserting the into the database."}, 500
return {"Error Message": "An error occurred upon inserting the item into the database."}, 500

# returns JSON with the created Material and returns CREATED status (201)
return order.json(), 201
Expand All @@ -52,4 +52,4 @@ def delete(self):
# request GET /orders
class OrderList(Resource):
def get(self):
return {'orders': [x.json() for x in OrderModel.query.all()]}
return {[x.json() for x in OrderModel.query.all()]}
2 changes: 1 addition & 1 deletion resources/raw_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ def put(self):
# route: /raw_materials
class RawMaterialList(Resource):
def get(self):
return {'Raw Materials': [x.json() for x in RawMaterialModel.query.all()]}
return {[x.json() for x in RawMaterialModel.query.all()]}
2 changes: 1 addition & 1 deletion resources/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ def get(self, recipe_id):
recipe = RecipeModel.find_by_id(recipe_id)

if recipe:
return {'Materials': [x.json() for x in recipe.get_all_materials()]}
return {[x.json() for x in recipe.get_all_materials()]}
else:
return {'message' : constants['ID_NOT_FOUND']}

0 comments on commit bb5304b

Please sign in to comment.