Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzSteven-Wang committed Dec 11, 2023
1 parent e7c4e1a commit 375abf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Describe what your service does here
"""

from flask import jsonify, request
from flask_restx import Resource, fields, reqparse, inputs
from service.common import status # HTTP Status Codes
from service.models import Product, Category
Expand Down Expand Up @@ -66,6 +65,7 @@ def index():
# }
return app.send_static_file("index.html")


# Define the model so that the docs reflect what can be sent
create_model = api.model(
"Product",
Expand All @@ -88,7 +88,7 @@ def index():
),
# pylint: disable=protected-access
"category": fields.String(
enum=Category._member_names_,
enum=Category._member_names_,
description="he category of Product (e.g., ELECTRONICS, FOOD, etc.)"
),
},
Expand Down Expand Up @@ -123,6 +123,7 @@ def index():
# R E S T A P I E N D P O I N T S
######################################################################


######################################################################
# PATH: /products/{id}
######################################################################
Expand Down Expand Up @@ -257,6 +258,7 @@ def post(self):
location_url = api.url_for(ProductResource, product_id=product.id, _external=True)
return product.serialize(), status.HTTP_201_CREATED, {"Location": location_url}


######################################################################
# PATH: /products/{id}/change_availability
######################################################################
Expand All @@ -270,7 +272,8 @@ class ChangeAvailResource(Resource):
def put(self, product_id):
"""
Change Product Availability
This endpoint will change the availability of a Product based on the id specified in the path.
This endpoint will change the availability of a Product based on the id specified in the path.
"""
app.logger.info(
"Request to change availability for product with id: %s", product_id
Expand All @@ -289,6 +292,7 @@ def put(self, product_id):

return message, status.HTTP_200_OK


######################################################################
# PATH: /products/collect
######################################################################
Expand All @@ -299,7 +303,7 @@ class CollectionResource(Resource):
"""
@api.doc("create_muiltiple_products")
@api.response(400, "The posted data was not valid")
#@api.expect(create_model)
# @api.expect(create_model)
@api.marshal_list_with(product_model, code=201)
def post(self):
"""
Expand All @@ -315,10 +319,10 @@ def post(self):
message.append(product.serialize())
return message, status.HTTP_201_CREATED


######################################################################
# PATH: /categories
######################################################################

@api.route("/categories", strict_slashes=False)
class Categories(Resource):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
COLLECT_URL = "/api/products/collect"
CONTENT_TYPE_JSON = "application/json"


######################################################################
# T E S T C A S E S
######################################################################
Expand Down

0 comments on commit 375abf6

Please sign in to comment.