As a System Administrator
I need to add query string support to the GET /shopcarts/{user_id} route
So that I can query the items based on the specified query parameter
Details and Assumptions
Given the URI in format /shopcarts?item-id=x
with "GET", we should get a list of shopcarts which contain an item with item_id "x"
And 200 OK if success, 400 BAD REQUEST if item-id is invalid (anything other than a non-negative integer)
Updated: After checking the sample code provided by professor, I don't think we need to check syntax in the query string and return 400
Reason for change: per prof: 'yes its fine if you only implement 1 query. Probably the most useful query would be to return all of the shopcarts that contain a particular item id. This would be helpful for store management to notify all customers that something in their cart just went on sale, or is out of stock.'
Using Flask-RESTX and add Swagger doc tags
Acceptance Criteria
Given we have item_id 100 with item_name "Ring100" in user_id 300 with hold = false
And we have item_id 100 with item_name "Ring100" in user_id 400 with hold = false
And we have item_id 200 with item_name "Ring" in user_id 400 with hold = true
And we have item_id 300 with item_name "Ring" in user_id 400 with hold = true
When we call GET on shopcarts?item-id=100
We get 200OK and receive a list of two user_ids: [300, 400]
When we call GET on shopcarts?item-id=200
We get 200OK and receive a list of 1 user_id: [400]
When we call GET on shopcarts?item-id=400
We get 200OK and receive an empty list: []
When we call GET on shopcarts?item-id=-1
Then we receive 400 BAD REQUEST
When we call GET on shopcarts?item-id=Ring
Then we receive 400 BAD REQUEST
As a System Administrator I need to add query string support to the GET /shopcarts/{user_id} route So that I can query the items based on the specified query parameter
Details and Assumptions
with "GET", we should get a list of shopcarts which contain an item with item_id "x"
400 BAD REQUEST if item-id is invalid (anything other than a non-negative integer)Acceptance Criteria