LilNHo is a helpful citizen, LilNHo finds eggs for half off deal at Costco and wants to share his find with others! He opens up Food4Lesser and creates a new grocery price posting for everyone to see. In his excitement, he accidentally makes a typo. He quickly updates the price of his post and goes on with shopping. Later when he is leaving, he realizes many people saw his post and came to Costco to buy eggs. With the eggs sold out, he deletes his posting so no one else comes to Costco disappointed.
Starts by calling POST /crowdsourcing/{store_id}/{grocery_id}/upload/{grocery_price} to share the deal he found. Then he calls PUT /crowdsourcing/{posting_id}/update/{grocery_price} when he realizes he made a typo and wants to update the price of his posting. Last, he calls DELETE /crowdsourcing/{posting_id}/delete when he finds there are no more eggs.
Josh lives with 3 of his friends and is looking for a way to grocery shop efficiently for the household. He discovers FoodForLesser and is ecstatic! First, Josh creates his grocery list by calling POST /lists. He then adds a list of items into his grocery list. To do so he: calls POST /lists/1/items/chicken_breast to add chicken breast for the gains Calls POST /lists/1/items/milk to add milk to his list Calls POST /lists/1/items/cheese to add cheese to his list Calls POST /lists/1/items/tomato to add tomato to his list Finally, he calls POST /stores/1/distribute to get the cheapest store for each item in his list Now with his distributed list of grocery items with their respective store(s), he and his roommates can effectively split up their grocery needs, in which each roommate can go to one grocery store and get the item that is cheapest there.
Misaki is a single mother. She wants to find a store that is close by with cheap groceries so her and her child won’t starve. She desperately needs baby food and caffeine. She requests a list of stores near her location by calling GET /stores. This gives her a list of stores within ten miles of her. She then makes her own grocery list by calling POST /lists. She wants to add coffee, baby food, and top ramen to her list and find the grocery store where the total cost of her list would be the cheapest. To do so she: Calls POST /lists/1/items/coffee to add coffee to her list Calls POST /lists/1/items/baby_food to add baby food to her list Calls POST /lists/1/items/top_ramen to add top ramen to her list Finally, she calls POST /stores/1/best which will give her the store that would give her the cheapest list
Wesley wants to do his weekly grocery shopping at one story because he is busy. He creates a grocery list with POST /lists. He then adds 1 ketchup POST /lists/{list_id}/items/1/1 and 2 hotdogs POST /lists/{list_id}/items/2/2 to the list. Wesley then changes his mind and decides to update his list to buy 4 hotdogs with PUT /lists/{posting_id}/items/4. He makes sure the change went through with GET /lists/{list_id}. Finally, he uses POST lists/stores/{list_id}/best to determine which store he should go to.
Wesley decides he wants bread and doritos. He creates a new grocery list with POST /lists and adds bread and doritos with POST /lists/{list_id}/items/3/1 and POST /lists/{list_id}/items/4/99 respectively. He uses POST lists/stores/{list_id}/best to find the best store to shop from. He then suddenly realizes he probably shouldn't but 99 doritos, so he deletes the doritos from his list with DELETE /lists/{posting_id}/items/, uses GET /lists/{list_id} to make sure the change went through, and reruns POST lists/stores/{list_id}/best to find the best shop.
At Costco, Wesley sees that the Costco hot dog is now $1.00. After making sure he is not dreaming, he shares this incredible deal on Food4Lesser using POST /crowdsourcing/{user_id}/upload/3/2/1. Unknown to Wesley, Josh also shares the deal on Food4Lesser, duplicating the deal.
Two different id's were returned, so I am assuming the deal was duplicated now. To fix this, check if the store_id, item_id, and price are already attributed to a sample in the database. If so, do not add/duplicate the deal.
Example Flow 1
LilNHo is a helpful citizen, LilNHo finds eggs for half off deal at Costco and wants to share his find with others! He opens up Food4Lesser and creates a new grocery price posting for everyone to see. In his excitement, he accidentally makes a typo. He quickly updates the price of his post and goes on with shopping. Later when he is leaving, he realizes many people saw his post and came to Costco to buy eggs. With the eggs sold out, he deletes his posting so no one else comes to Costco disappointed. Starts by calling POST /crowdsourcing/{store_id}/{grocery_id}/upload/{grocery_price} to share the deal he found. Then he calls PUT /crowdsourcing/{posting_id}/update/{grocery_price} when he realizes he made a typo and wants to update the price of his posting. Last, he calls DELETE /crowdsourcing/{posting_id}/delete when he finds there are no more eggs.
Sharing deal
Update price
Deleting deal
Example Flow 2
Josh lives with 3 of his friends and is looking for a way to grocery shop efficiently for the household. He discovers FoodForLesser and is ecstatic! First, Josh creates his grocery list by calling POST /lists. He then adds a list of items into his grocery list. To do so he: calls POST /lists/1/items/chicken_breast to add chicken breast for the gains Calls POST /lists/1/items/milk to add milk to his list Calls POST /lists/1/items/cheese to add cheese to his list Calls POST /lists/1/items/tomato to add tomato to his list Finally, he calls POST /stores/1/distribute to get the cheapest store for each item in his list Now with his distributed list of grocery items with their respective store(s), he and his roommates can effectively split up their grocery needs, in which each roommate can go to one grocery store and get the item that is cheapest there.
Create grocery list
Add items to grocery list
Distributing list
Example Flow 3
Misaki is a single mother. She wants to find a store that is close by with cheap groceries so her and her child won’t starve. She desperately needs baby food and caffeine. She requests a list of stores near her location by calling GET /stores. This gives her a list of stores within ten miles of her. She then makes her own grocery list by calling POST /lists. She wants to add coffee, baby food, and top ramen to her list and find the grocery store where the total cost of her list would be the cheapest. To do so she: Calls POST /lists/1/items/coffee to add coffee to her list Calls POST /lists/1/items/baby_food to add baby food to her list Calls POST /lists/1/items/top_ramen to add top ramen to her list Finally, she calls POST /stores/1/best which will give her the store that would give her the cheapest list
Get stores nearby
Create grocery list
Add grocery items to list
Finding best store
Wesley Test Flow 1:
Wesley wants to do his weekly grocery shopping at one story because he is busy. He creates a grocery list with
POST /lists
. He then adds 1 ketchupPOST /lists/{list_id}/items/1/1
and 2 hotdogsPOST /lists/{list_id}/items/2/2
to the list. Wesley then changes his mind and decides to update his list to buy 4 hotdogs withPUT /lists/{posting_id}/items/4
. He makes sure the change went through withGET /lists/{list_id}
. Finally, he usesPOST lists/stores/{list_id}/best
to determine which store he should go to.Create list
Add items to list
Update list
Get list
Find best store
Wesley Test Flow 2:
Wesley decides he wants bread and doritos. He creates a new grocery list with
POST /lists
and adds bread and doritos withPOST /lists/{list_id}/items/3/1
andPOST /lists/{list_id}/items/4/99
respectively. He usesPOST lists/stores/{list_id}/best
to find the best store to shop from. He then suddenly realizes he probably shouldn't but 99 doritos, so he deletes the doritos from his list withDELETE /lists/{posting_id}/items/
, usesGET /lists/{list_id}
to make sure the change went through, and rerunsPOST lists/stores/{list_id}/best
to find the best shop.Create list
Add items to grocery list
Find best store
Delete item from list
Get list
Find best store:
Wesley Test Flow 3:
At Costco, Wesley sees that the Costco hot dog is now $1.00. After making sure he is not dreaming, he shares this incredible deal on Food4Lesser using
POST /crowdsourcing/{user_id}/upload/3/2/1
. Unknown to Wesley, Josh also shares the deal on Food4Lesser, duplicating the deal.Wesley's upload
Josh's upload:
Two different id's were returned, so I am assuming the deal was duplicated now. To fix this, check if the store_id, item_id, and price are already attributed to a sample in the database. If so, do not add/duplicate the deal.