diff --git a/backend/API/Controllers/ShoppingListController.cs b/backend/API/Controllers/ShoppingListController.cs index b0df2d7..ddeb6c1 100644 --- a/backend/API/Controllers/ShoppingListController.cs +++ b/backend/API/Controllers/ShoppingListController.cs @@ -18,6 +18,10 @@ namespace API.Controllers _shoppingListLogic = shoppingListLogic; } + /// <summary> + /// Gets the entire shoppinglist connected to the user + /// </summary> + /// <returns>returns a list of shoppinglist items if it fails it returns a confliftobjectresult with a message of why it failed</returns> [Authorize] [HttpGet("get")] public async Task<IActionResult> ReadShoppingList() @@ -28,6 +32,11 @@ namespace API.Controllers return await _shoppingListLogic.ReadShoppingList(userId); } + /// <summary> + /// Adds an item to the shopping list + /// </summary> + /// <param name="listItemDTO"></param> + /// <returns></returns> [Authorize] [HttpPost("add")] public async Task<IActionResult> AddItem([FromBody] ShoppingListItemDTO listItemDTO) @@ -38,6 +47,11 @@ namespace API.Controllers return await _shoppingListLogic.AddItemToShoppingList(listItemDTO, userId); } + /// <summary> + /// Checks/Unchecks an item on the shoppinglist + /// </summary> + /// <param name="itemId">The item to be checked/unchecked</param> + /// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns> [Authorize] [HttpPut("check")] public async Task<IActionResult> CheckItem(int itemId) @@ -48,6 +62,12 @@ namespace API.Controllers return await _shoppingListLogic.CheckItemInShoppingList(userId, itemId); } + /// <summary> + /// Edits an item on the shoppinglist + /// </summary> + /// <param name="listItemDTO">The edited item</param> + /// <param name="itemId">The item to be edited</param> + /// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns> [Authorize] [HttpPut("update")] public async Task<IActionResult> UpdateItem([FromBody] ShoppingListItemDTO listItemDTO, int itemId) @@ -58,6 +78,11 @@ namespace API.Controllers return await _shoppingListLogic.UpdateItemInShoppingList(userId, itemId, listItemDTO); } + /// <summary> + /// Deletes an item on the shoppinglist + /// </summary> + /// <param name="itemId">The item to be deleted</param> + /// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns> [Authorize] [HttpDelete("delete")] public async Task<IActionResult> DeleteItem(int itemId) @@ -68,6 +93,11 @@ namespace API.Controllers return await _shoppingListLogic.DeleteItemInShoppingList(userId, itemId); } + /// <summary> + /// Add an entire recipes ingredients to the shoppinglist + /// </summary> + /// <param name="recipeId">The recipes ingredients to be added</param> + /// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns> [Authorize] [HttpPost("recipeadd")] public async Task<IActionResult> AddARecipesItems(int recipeId)