Interface IShoppingItemsController

All Known Implementing Classes:
ShoppingItemsController

public interface IShoppingItemsController
This interface contains the outline of essential functions for the ShoppingItemsController.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<Object>
    acceptSuggestion(ItemRemoveDTO itemDTO, org.springframework.security.core.Authentication authentication)
    Accepts a suggested item on the shopping list for a given fridge.
    org.springframework.http.ResponseEntity<Object>
    addToShoppingList(ItemDTO itemDTO, Long fridgeId, boolean suggestion, org.springframework.security.core.Authentication authentication)
    Adds items to the shopping list for a given fridge.
    org.springframework.http.ResponseEntity<Object>
    buyItemsFromShoppingList(List<ItemMoveDTO> itemDTOList, org.springframework.security.core.Authentication authentication)
    Buys the items on the shopping list for a given fridge and places it in fridge items.
    org.springframework.http.ResponseEntity<Object>
    deleteAllItemsFromShoppingList(List<ItemRemoveDTO> itemDTOList, org.springframework.security.core.Authentication authentication)
    Deletes the items on the shopping list for a given fridge.
    org.springframework.http.ResponseEntity<Object>
    deleteItemFromShoppingList(ItemRemoveDTO itemRemoveDTO, boolean suggestion, org.springframework.security.core.Authentication authentication)
    An item can be deleted from a shopping list of a fridge given the following conditions: - User is a superuser, then user can delete both suggested and actual items - User is a normal user, then user can delete suggested items but not actual items.
    org.springframework.http.ResponseEntity<Object>
    Gets the items on the shopping list for a given fridge.
    org.springframework.http.ResponseEntity<Object>
    updateShoppingListItem(ShoppingItemUpdateDTO shoppingItemUpdateDTO, org.springframework.security.core.Authentication authentication)
    This method updates a given fridge item to contain the information received.
  • Method Details

    • addToShoppingList

      @PostMapping("/shopping/add") org.springframework.http.ResponseEntity<Object> addToShoppingList(@RequestBody ItemDTO itemDTO, @RequestParam(name="fridgeId") Long fridgeId, @RequestParam(name="suggestion") boolean suggestion, org.springframework.security.core.Authentication authentication)
      Adds items to the shopping list for a given fridge.
      Parameters:
      itemDTO - the item to add to the shopping list
      fridgeId - the ID of the fridge for which to add items to the shopping list
      suggestion - whether or not the item was a suggestion
      Returns:
      a response entity indicating success
    • deleteItemFromShoppingList

      @DeleteMapping("/shopping/delete") org.springframework.http.ResponseEntity<Object> deleteItemFromShoppingList(@RequestBody ItemRemoveDTO itemRemoveDTO, @RequestParam(name="suggestion") boolean suggestion, org.springframework.security.core.Authentication authentication)
      An item can be deleted from a shopping list of a fridge given the following conditions: - User is a superuser, then user can delete both suggested and actual items - User is a normal user, then user can delete suggested items but not actual items.
      Parameters:
      itemRemoveDTO - the item to remove from the shopping list
      suggestion - whether the item was a suggestion
      Returns:
      a response entity indicating success
    • deleteAllItemsFromShoppingList

      @PostMapping(value="/shopping/delete/all", consumes="application/json") org.springframework.http.ResponseEntity<Object> deleteAllItemsFromShoppingList(@RequestBody List<ItemRemoveDTO> itemDTOList, org.springframework.security.core.Authentication authentication)
      Deletes the items on the shopping list for a given fridge.
      Parameters:
      itemDTOList - the list of items to buy
      Returns:
      a response entity indicating success
    • updateShoppingListItem

      @PutMapping("/shopping/update") org.springframework.http.ResponseEntity<Object> updateShoppingListItem(@RequestBody ShoppingItemUpdateDTO shoppingItemUpdateDTO, org.springframework.security.core.Authentication authentication)
      This method updates a given fridge item to contain the information received.
      Parameters:
      shoppingItemUpdateDTO - New shopping item information, given as a ShoppingItemUpdateDTO
      authentication - The authentication of the user who sent in the request, given as an Authentication object.
      Returns:
      A ResponseEntity indicating the success or failure of the operation.
    • buyItemsFromShoppingList

      @PostMapping(value="/shopping/buy", consumes="application/json") org.springframework.http.ResponseEntity<Object> buyItemsFromShoppingList(@RequestBody List<ItemMoveDTO> itemDTOList, org.springframework.security.core.Authentication authentication)
      Buys the items on the shopping list for a given fridge and places it in fridge items.
      Parameters:
      itemDTOList - the list of items to buy
      Returns:
      a response entity indicating success
    • acceptSuggestion

      @PostMapping("/shopping/suggestion") org.springframework.http.ResponseEntity<Object> acceptSuggestion(@RequestBody ItemRemoveDTO itemDTO, org.springframework.security.core.Authentication authentication)
      Accepts a suggested item on the shopping list for a given fridge.
      Parameters:
      itemDTO - the item to accept
      Returns:
      a response entity indicating success
    • getShoppingList

      @GetMapping("/shopping/get") org.springframework.http.ResponseEntity<Object> getShoppingList(@RequestParam(name="fridgeId") Long fridgeId)
      Gets the items on the shopping list for a given fridge.
      Parameters:
      fridgeId - the ID of the fridge for which to retrieve items from the shopping list
      Returns:
      a response entity containing the shopping list items