From 38cf388ea80f03b81dc37b8b581f0d20d9ff12d2 Mon Sep 17 00:00:00 2001 From: Jeas0001 Date: Wed, 7 May 2025 11:54:02 +0200 Subject: [PATCH] Shoppinglistcontroller comments --- .../API/Controllers/ShoppingListController.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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; } + /// + /// Gets the entire shoppinglist connected to the user + /// + /// returns a list of shoppinglist items if it fails it returns a confliftobjectresult with a message of why it failed [Authorize] [HttpGet("get")] public async Task ReadShoppingList() @@ -28,6 +32,11 @@ namespace API.Controllers return await _shoppingListLogic.ReadShoppingList(userId); } + /// + /// Adds an item to the shopping list + /// + /// + /// [Authorize] [HttpPost("add")] public async Task AddItem([FromBody] ShoppingListItemDTO listItemDTO) @@ -38,6 +47,11 @@ namespace API.Controllers return await _shoppingListLogic.AddItemToShoppingList(listItemDTO, userId); } + /// + /// Checks/Unchecks an item on the shoppinglist + /// + /// The item to be checked/unchecked + /// returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed [Authorize] [HttpPut("check")] public async Task CheckItem(int itemId) @@ -48,6 +62,12 @@ namespace API.Controllers return await _shoppingListLogic.CheckItemInShoppingList(userId, itemId); } + /// + /// Edits an item on the shoppinglist + /// + /// The edited item + /// The item to be edited + /// returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed [Authorize] [HttpPut("update")] public async Task UpdateItem([FromBody] ShoppingListItemDTO listItemDTO, int itemId) @@ -58,6 +78,11 @@ namespace API.Controllers return await _shoppingListLogic.UpdateItemInShoppingList(userId, itemId, listItemDTO); } + /// + /// Deletes an item on the shoppinglist + /// + /// The item to be deleted + /// returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed [Authorize] [HttpDelete("delete")] public async Task DeleteItem(int itemId) @@ -68,6 +93,11 @@ namespace API.Controllers return await _shoppingListLogic.DeleteItemInShoppingList(userId, itemId); } + /// + /// Add an entire recipes ingredients to the shoppinglist + /// + /// The recipes ingredients to be added + /// returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed [Authorize] [HttpPost("recipeadd")] public async Task AddARecipesItems(int recipeId)