From 559294aa1e4c7af02c1d89c52736c6726925c83f Mon Sep 17 00:00:00 2001
From: Anders Austlid <andemau@ntnu.no>
Date: Fri, 5 May 2023 19:40:11 +0200
Subject: [PATCH] Added and updated some javadoc

---
 .idea/misc.xml                                |  2 +-
 .../v233/SmartMat/config/CorsConfig.java      |  6 ++---
 .../v233/SmartMat/config/SecurityConfig.java  |  3 ---
 .../authentiation/AuthenticationConfig.java   |  1 -
 .../config/properties/DomainProperty.java     |  1 -
 .../controller/AllergyController.java         |  1 -
 .../controller/AuthenticationController.java  |  1 -
 .../SmartMat/controller/RecipeController.java |  3 ---
 .../controller/ShoppingListController.java    |  3 +++
 .../controller/WeeklyMenuController.java      | 26 ++++++++-----------
 .../controller/group/FridgeController.java    |  7 ++++-
 .../controller/group/GroupController.java     |  7 +++++
 .../controller/group/WasteController.java     |  2 ++
 .../controller/product/ProductController.java |  3 +--
 .../user/AchievementController.java           |  1 -
 .../controller/user/UserController.java       | 14 +++-------
 .../v233/SmartMat/dto/enums/Authority.java    |  1 -
 .../dto/request/FridgeProductRequest.java     |  5 ++++
 .../SmartMat/dto/request/LoginRequest.java    |  5 ----
 .../SmartMat/dto/request/ProductRequest.java  |  9 +++++++
 .../dto/request/RegisterUserRequest.java      |  4 ++-
 .../dto/request/UpdateUserRequest.java        |  3 ---
 .../SmartMat/dto/request/WasteRequest.java    |  7 +++++
 .../request/group/ChangeAuthorityRequest.java |  6 +++++
 .../dto/response/AllergyResponse.java         |  2 +-
 .../SmartMat/dto/response/RecipeDetails.java  |  2 +-
 .../dto/response/RecipeWithMatchCount.java    |  2 +-
 .../response/group/GroupDetailsResponse.java  |  3 +++
 .../dto/response/group/UserAuthorityInfo.java |  5 ++++
 .../v233/SmartMat/entity/Recipe.java          |  6 ++---
 .../v233/SmartMat/entity/ShoppingList.java    |  6 ++---
 .../idatt2016/v233/SmartMat/entity/Waste.java |  6 ++---
 .../fridgeProduct/FridgeProductAsso.java      |  6 +++++
 .../SmartMat/entity/group/Achievement.java    |  5 ++--
 .../v233/SmartMat/entity/group/Fridge.java    |  1 -
 .../v233/SmartMat/entity/group/Group.java     |  7 +++--
 .../SmartMat/entity/group/UserGroupAsso.java  |  5 ++--
 .../SmartMat/entity/group/UserGroupId.java    |  7 ++++-
 .../v233/SmartMat/entity/product/Allergy.java |  6 +++--
 .../SmartMat/entity/product/Category.java     | 10 +++++++
 .../v233/SmartMat/entity/product/Product.java |  9 ++++---
 .../v233/SmartMat/entity/user/User.java       |  4 +--
 .../repository/group/FridgeRepository.java    |  6 +++++
 .../repository/group/GroupRepository.java     | 17 ++++++++++--
 44 files changed, 144 insertions(+), 92 deletions(-)

diff --git a/.idea/misc.xml b/.idea/misc.xml
index ba18a6c3..14613fe5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -8,5 +8,5 @@
       </list>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-20" project-jdk-type="JavaSDK" />
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_19" project-jdk-name="openjdk-20" project-jdk-type="JavaSDK" />
 </project>
\ No newline at end of file
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/CorsConfig.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/CorsConfig.java
index 8c238f9a..1a228e45 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/CorsConfig.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/CorsConfig.java
@@ -12,9 +12,8 @@ import java.util.Arrays;
 
 /**
  * Cors configuration for application
- * @author Birk
- * @version 1.0
- * @since 04.04.2023
+ * @author Birk, Anders
+ * @version 1.1
  */
 @Configuration
 @AllArgsConstructor
@@ -35,7 +34,6 @@ public class CorsConfig {
             public void addCorsMappings(CorsRegistry registry) {
                 registry.addMapping("/**")
                         .allowedOrigins(Arrays.asList("https://localhost",
-                                "https://10.24.38.136",
                                 domainProperty.domain()
                         ).toArray(String[]::new))
                         .allowedMethods(Arrays.asList(
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java
index 5aa3c4bf..446e5800 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java
@@ -13,7 +13,6 @@ import org.springframework.security.web.SecurityFilterChain;
  * Configs for security and authentication
  * @author Birk
  * @version 1.0
- * @since 04.04.2023
  */
 @Configuration
 @AllArgsConstructor
@@ -23,8 +22,6 @@ public class SecurityConfig {
      * Configures the HttpSecurity for the application.
      * Dose not need ot have csrf enabled, because we are using jwt
      * and the application is stateless
-     * <p>
-     * TODO: Enable CORS policy when possible!
      *
      * @param http HttpSecurity to configure
      * @return SecurityFilterChain with configured HttpSecurity
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/authentiation/AuthenticationConfig.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/authentiation/AuthenticationConfig.java
index 6a12193c..e7158b2a 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/authentiation/AuthenticationConfig.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/authentiation/AuthenticationConfig.java
@@ -26,7 +26,6 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
  * Configures the authentication for the application.
  * @author Anders and  birk
  * @version 1.1
- * @since 05.04.2023
  */
 @Configuration
 public class AuthenticationConfig {
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/properties/DomainProperty.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/properties/DomainProperty.java
index 3ec7bbdb..5a096094 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/properties/DomainProperty.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/properties/DomainProperty.java
@@ -6,7 +6,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
  * Configuration properties for the domain of the application
  * @author Birk
  * @version 1.0
- * @since 04.04.2023
  */
 @ConfigurationProperties(prefix = "domain")
 public record DomainProperty (String domain){
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AllergyController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AllergyController.java
index a8cbdf8c..578ce1f9 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AllergyController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AllergyController.java
@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
 /**
  * Controller for allergies
  * @author Stian Lyng
- * @version 1.0
  */
 @AllArgsConstructor
 @RestController
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AuthenticationController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AuthenticationController.java
index 8791924b..f2d40cf8 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AuthenticationController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/AuthenticationController.java
@@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RestController;
  *
  * @author Anders
  * @version 1.0
- * @since 19.04.2023
  */
 
 @RestController
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/RecipeController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/RecipeController.java
index aaa3bb28..4d737a31 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/RecipeController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/RecipeController.java
@@ -23,9 +23,6 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping("/api/recipe")
 public class RecipeController {
 
-    /**
-     * The recipe service
-     */
     private final RecipeService recipeService;   
 
     /**
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java
index 8f5b6021..58885303 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java
@@ -45,6 +45,7 @@ public class ShoppingListController {
      * Gets a shopping list by its ID
      *
      * @param id the shopping list ID
+     * @param authentication The authentication object of the user.
      * @return the shopping list, or an error if the ID is invalid,
      * or the user dose not have the rights to edit the shopping list
      */
@@ -65,6 +66,7 @@ public class ShoppingListController {
      * Gets a shopping list by its group ID
      * 
      * @param id the request containing the group ID
+     * @param authentication The authentication object of the user.
      * @return the shopping list, or an error if the ID is invalid
      */
     @GetMapping("/group/{groupId}")
@@ -150,6 +152,7 @@ public class ShoppingListController {
      *
      * @param shoppingListId the shopping list ID
      * @param ean           the product EAN
+     * @param auth The authentication object of the user.
      * @return the shopping list with the removed product, or an error if the shopping list ID or EAN is invalid
      */
     @DeleteMapping("/removeProduct/{shoppingListId}/{ean}")
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/WeeklyMenuController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/WeeklyMenuController.java
index 74c65bb7..66e95908 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/WeeklyMenuController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/WeeklyMenuController.java
@@ -14,28 +14,24 @@ import ntnu.idatt2016.v233.SmartMat.dto.response.WeeklyMenuResponse;
 import ntnu.idatt2016.v233.SmartMat.service.RecipeService;
 import ntnu.idatt2016.v233.SmartMat.service.WeeklyMenuService;
 
+/**
+ * Controller for weekly menu
+ *
+ * @author Stian Lyng
+ * @version 1.0
+ */
 @AllArgsConstructor
 @RestController
 @RequestMapping("/api/weeklymenu")
 public class WeeklyMenuController {
-    
-    /*
-    private WeeklyMenuService weeklyMenuService;
-    
-    @GetMapping("/{fridgeId}")
-    public ResponseEntity<List<WeeklyMenuResponse>> getWeeklyMenu(@PathVariable("fridgeId") Long fridgeId) {
-        List<WeeklyMenuResponse> weeklyMenu = weeklyMenuService.getWeeklyMenu(fridgeId);
-        
-        if (weeklyMenu.isEmpty()) {
-            return ResponseEntity.notFound().build();
-        } else {
-            return ResponseEntity.ok(weeklyMenu);
-        }
-    }
-    */
 
     final private RecipeService recipeService;
 
+    /**
+     * Gets weekly menu for a fridge
+     * @param fridgeId the id of the fridge
+     * @return the weekly menu for the fridge
+     */
     @GetMapping("/{fridgeId}")
     public ResponseEntity<Object> compareWeeklyMenuAndRecipeProducts(@PathVariable("fridgeId") Integer fridgeId) {
         List<RecipeWithMatchCount> weeklyMenuDetails = recipeService.getWeeklyMenu(fridgeId);
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/FridgeController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/FridgeController.java
index 2869134c..20bde998 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/FridgeController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/FridgeController.java
@@ -58,7 +58,8 @@ public class FridgeController {
 
     /**
      * Gets the fridge by its fridge id
-     * @param fridgeId the id of the fridge
+     * @param fridgeId the id of the fridge to get
+     * @param authentication a user authentication object for validation of user authorization
      * @return the fridge if it exists, or a 404 if it doesn't, or a 403 if the user is not in the fridge
      */
     @GetMapping("/fridge/{fridgeId}")
@@ -79,6 +80,7 @@ public class FridgeController {
      * Adds a product to the fridge of a group
      *
      * @param request the request containing the group id and product id
+     * @param authentication a user authentication object for validation of user authorization
      * @return success if the product was added, bad request if the product was already in the fridge, or not found if the group or product doesn't exist
      */
     @PostMapping("/group/product")
@@ -107,6 +109,7 @@ public class FridgeController {
     /**
      * Updates a product in a fridge
      * @param request the request containing the group id and product id
+     * @param authentication a user authentication object for validation of user authorization
      * @return success if the product was added, bad request if the product was already in the fridge,
      * or not found if the group or product doesn't exist
      */
@@ -174,6 +177,7 @@ public class FridgeController {
     /**
      * Deletes a product from the fridge
      * @param fridgeProductId the id of the fridge product association
+     * @param authentication the authentication of the user
      * @return success if the product was deleted, bad request if the product wasn't found
      * , or forbidden if the user is not in the group
      */
@@ -207,6 +211,7 @@ public class FridgeController {
      * Deletes a product from the fridge and creates a waste object from it.
      *
      * @param fridgeProductId The id of the fridge product association to be deleted
+     * @param authentication The authentication of the user
      * @return A ResponseEntity with status code 200 if successful,
      * or status code 404 if the specified fridge product association was not found.
      * or status code 403 if the user is not in the group
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
index 7ed47a10..48c6829c 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
@@ -37,6 +37,7 @@ public class GroupController {
     /**
      * Gets a group by its id
      * @param groupId the id of the group
+     * @param auth the authentication of the user
      * @return a ResponseEntity containing the group if it exists, or a 404 if it doesn't
      */
     @GetMapping("/{groupId}")
@@ -72,6 +73,7 @@ public class GroupController {
      * Creates a new group
      *
      * @param groupRequest the group to create
+     * @param auth the authentication of the user
      * @return a ResponseEntity containing the created group if it was created successfully,
      * or a 400 if the group name is invalid or already exists, or if the username is invalid
      */
@@ -130,6 +132,7 @@ public class GroupController {
      * Gets the level of a group
      *
      * @param groupId the id of the group
+     * @param auth the authentication of the user
      * @return a ResponseEntity containing the level of the group if it exists, or a 404 if it doesn't
      */
     @GetMapping("/{groupId}/level")
@@ -174,6 +177,7 @@ public class GroupController {
      * Updates the open/closed status of the group with the specified ID.
      *
      * @param groupId the ID of the group to update
+     * @param auth the authentication of the user
      * @return a ResponseEntity with a Boolean value indicating whether the operation was successful
      */
     @PutMapping("/{groupId}/changeOpen")
@@ -196,6 +200,7 @@ public class GroupController {
      * Handles the HTTP PUT request to change the primary group of a user.
      *
      * @param newPrimaryGroupId the ID of the new primary group
+     * @param auth the authentication of the user
      * @return a ResponseEntity object containing an HTTP status code and the updated UserGroupAsso object,
      *         or a ResponseEntity object with an HTTP status code indicating that the request was not successful
      */
@@ -244,6 +249,7 @@ public class GroupController {
      * Handles the HTTP POST request to add a new connection between a user and a group.
      *
      * @param groupConnectionRequest the request object containing the username and link code of the user and group to be connected
+     * @param auth the authentication of the user
      * @return a ResponseEntity object containing an HTTP status code and the newly created UserGroupAsso object,
      *         or a ResponseEntity object with an HTTP status code indicating that the request was not successful
      */
@@ -294,6 +300,7 @@ public class GroupController {
      * Changes the authority level of a user in a group.
      *
      * @param authorityRequest the request object containing the username and group ID of the user to change the authority of
+     * @param auth the authentication of the user
      * @return a ResponseEntity object containing the updated UserGroupAsso object and an HTTP status code of 200,
      *        or a ResponseEntity object with an HTTP status code of 403 if the user is not authorized to change the authority,
      *         or a ResponseEntity object with an HTTP status code of 404 if the group or user does not exist
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/WasteController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/WasteController.java
index 0c804cf2..444287ff 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/WasteController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/WasteController.java
@@ -144,6 +144,7 @@ public class WasteController {
      * The amount is calculated based on the total cost of the expired products.
      *
      * @param groupId the ID of the group to retrieve the lost money from
+     * @param authentication The authentication of the user.
      * @return a ResponseEntity with the lost money as a Double if found, or a ResponseEntity with status 404 if the group is not found
      */
     @GetMapping("/statistic/lostMoney/{groupId}")
@@ -159,6 +160,7 @@ public class WasteController {
      * Retrieves the amount of CO2 emitted annually per person in a specific group.
      *
      * @param groupId the ID of the group to retrieve the statistic for
+     * @param authentication The authentication of the user.
      * @return a ResponseEntity containing the amount of CO2 emitted annually per person in the group,
      *         or a ResponseEntity with HTTP status 404 (not found) if the group or data is not found
      */
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/product/ProductController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/product/ProductController.java
index abda8869..742a2ca7 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/product/ProductController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/product/ProductController.java
@@ -23,7 +23,6 @@ import java.util.Optional;
  * It uses the product service to handle the requests.
  * @version 1.0
  * @Author Birk
- * @since 26.04.2023
  */
 @RestController
 @AllArgsConstructor
@@ -130,7 +129,7 @@ public class ProductController {
 
     /**
      * Returns all products in the database.
-     * @return All products in the database.
+     * @return A list of all products in the database.
      */
     @GetMapping("/")
     public ResponseEntity<List<Product>> getAllProducts() {
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/AchievementController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/AchievementController.java
index 2b49fd4b..30de9880 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/AchievementController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/AchievementController.java
@@ -18,7 +18,6 @@ import java.util.Optional;
  *
  * @author Anders
  * @version 1.0
- * @sinc 20.04.2023
  */
 
 @AllArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/UserController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/UserController.java
index c591bc54..df6a56d6 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/UserController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/user/UserController.java
@@ -26,7 +26,6 @@ import java.util.stream.Collectors;
  * It uses the user service to handle the requests.
  * @author Birk
  * @version 1.2
- * @since 20.04.2023
  */
 @AllArgsConstructor
 @RestController
@@ -38,16 +37,6 @@ public class UserController {
     PasswordEncoder passwordEncoder;
 
     /**
-     * Use this JSON format:
-     * {
-     *     "username":"kari123",
-     *     "password":"sjokoladekake",
-     *     "email":"kari.nordman@gmail.com",
-     *     "firstName":"kari",
-     *     "lastName":"nordmann",
-     *     "birthDate":"2001-12-12"
-     * }
-     *
      * create a new user in the database
      * uses the user service
      * @param user The user to be registered.
@@ -88,6 +77,7 @@ public class UserController {
     /**
      * Get a user from the database.
      * @param username The username of the user to be fetched.
+     * @param authentication The authentication object of the user.
      * @return The user with the given username.
      */
     @GetMapping("/get/{username}")
@@ -110,6 +100,7 @@ public class UserController {
      * Adds the specified allergy to the user with the given username.
      *
      * @param allergyRequest the request object containing the username and allergy name
+     * @param authentication The authentication object of the user.
      * @return a ResponseEntity with a boolean indicating whether the operation was successful
      */
     @PostMapping("/addAllergy")
@@ -126,6 +117,7 @@ public class UserController {
      * Deletes the specified allergy from the user with the given username.
      *
      * @param allergyRequest the request object containing the username and allergy name
+     * @param authentication The authentication object of the user.
      * @return a ResponseEntity with a boolean indicating whether the operation was successful
      */
     @DeleteMapping("/deleteAllergy")
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/enums/Authority.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/enums/Authority.java
index d2aa0f37..aff64ff9 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/enums/Authority.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/enums/Authority.java
@@ -5,7 +5,6 @@ package ntnu.idatt2016.v233.SmartMat.dto.enums;
  *
  * @author Birk
  * @version 2.0
- * @since 19.04.2023
  *
  */
 public enum Authority{
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/FridgeProductRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/FridgeProductRequest.java
index 0df58b4f..48da0a31 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/FridgeProductRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/FridgeProductRequest.java
@@ -2,7 +2,12 @@ package ntnu.idatt2016.v233.SmartMat.dto.request;
 
 /**
  * FridgeProductRequest is a record class representing a request to add a product to a fridge.
+ * @param fridgeProductId the id of the fridge product
  * @param groupId the id of the group
+ * @param ean the ean of the product
+ * @param amount the amount of the product
+ * @param days the days before expiry date of the product
+ * @param price the price of the product
  */
 public record FridgeProductRequest(long fridgeProductId, long groupId, long ean, int amount, int days, double price) {
 }
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/LoginRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/LoginRequest.java
index f9ca9f78..709e502b 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/LoginRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/LoginRequest.java
@@ -2,11 +2,6 @@ package ntnu.idatt2016.v233.SmartMat.dto.request;
 
 /**
  * LoginRequest is a record class representing a login request.
- *
- * @author Anders
- * @version 1.0
- * @since 18.04.2023
- *
  * @param username
  * @param password
  */
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/ProductRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/ProductRequest.java
index 372634c7..4e067b92 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/ProductRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/ProductRequest.java
@@ -4,6 +4,15 @@ import lombok.Builder;
 
 import java.util.List;
 
+/**
+ * ProductRequest is a record class representing a request to create a product.
+ * @param ean the ean of the product
+ * @param name the name of the product
+ * @param description the description of the product
+ * @param image the image of the product
+ * @param price the price of the product
+ * @param allergies the allergies of the product
+ */
 @Builder
 public record ProductRequest(long ean, String name, String description, String image, double price, List<String> allergies) {
 }
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/RegisterUserRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/RegisterUserRequest.java
index 988d732d..6df60e0f 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/RegisterUserRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/RegisterUserRequest.java
@@ -7,7 +7,9 @@ import java.sql.Date;
  * @param username the username of the user
  * @param password the password of the user
  * @param email the email of the user
- *
+ * @param firstName the first name of the user
+ * @param lastName the last name of the user
+ * @param birthDate the birth date of the user
  */
 public record RegisterUserRequest(String username, String password, String email, String firstName, String lastName,
                                   Date birthDate){
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/UpdateUserRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/UpdateUserRequest.java
index 159107c3..2e7e6ccd 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/UpdateUserRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/UpdateUserRequest.java
@@ -5,9 +5,6 @@ import java.util.List;
 
 /**
  * This class represents a request to update a user
- * @author Birk
- * @version 1.0
- * @since 26.04.2023
  *
  * @param firstName the first name of the user
  * @param lastName the last name of the user
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/WasteRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/WasteRequest.java
index dbf75a26..929fc9a5 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/WasteRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/WasteRequest.java
@@ -1,5 +1,12 @@
 package ntnu.idatt2016.v233.SmartMat.dto.request;
 
+/**
+ * WasteRequest is a record class representing a request to add a product to a fridge.
+ * @param groupId the id of the group
+ * @param ean the ean of the product
+ * @param amount the amount of the product
+ * @param unit the unit of the product
+ */
 public record WasteRequest(long groupId, long ean, double amount, String unit) {
 
 }
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/group/ChangeAuthorityRequest.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/group/ChangeAuthorityRequest.java
index ae7282ae..2a4457e9 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/group/ChangeAuthorityRequest.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/request/group/ChangeAuthorityRequest.java
@@ -1,4 +1,10 @@
 package ntnu.idatt2016.v233.SmartMat.dto.request.group;
 
+/**
+ * ChangeAuthorityRequest is a record class representing a request to change the authority of a user in a group.
+ * @param username the username of the user
+ * @param groupId the id of the group
+ * @param authority the new authority of the user
+ */
 public record ChangeAuthorityRequest(String username, long groupId, String authority) {}
 
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/AllergyResponse.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/AllergyResponse.java
index 66b2f728..fcf34981 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/AllergyResponse.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/AllergyResponse.java
@@ -6,7 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 /**
- * This class represents a response for a weekly menu.
+ * This class represents an allergy response
  */
 @Data
 @Builder
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeDetails.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeDetails.java
index 2fd6f3f2..f02cb54c 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeDetails.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeDetails.java
@@ -6,7 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 /**
- * This class represents a response for a weekly menu.
+ * This class represents recipe details response
  */
 @Data
 @Builder
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeWithMatchCount.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeWithMatchCount.java
index 0dbdf685..72ad5a44 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeWithMatchCount.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/RecipeWithMatchCount.java
@@ -6,7 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 /**
- * This class represents a response for a weekly menu.
+ * This class represents recipe response with match count
  */
 @Data
 @Builder
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/GroupDetailsResponse.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/GroupDetailsResponse.java
index 38016d44..e2e1c7dd 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/GroupDetailsResponse.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/GroupDetailsResponse.java
@@ -5,6 +5,9 @@ import ntnu.idatt2016.v233.SmartMat.entity.group.Group;
 
 import java.util.List;
 
+/**
+ * GroupDetailsResponse is a class representing a response containing details about a group.
+ */
 @Data
 public class GroupDetailsResponse {
     private long groupId;
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/UserAuthorityInfo.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/UserAuthorityInfo.java
index 260607e2..96f404c1 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/UserAuthorityInfo.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/dto/response/group/UserAuthorityInfo.java
@@ -1,3 +1,8 @@
 package ntnu.idatt2016.v233.SmartMat.dto.response.group;
 
+/**
+ * UserAuthorityInfo is a record class representing a response to a group request.
+ * @param username the username of the user
+ * @param authority the authority of the user
+ */
 public record UserAuthorityInfo(String username, String authority) {}
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Recipe.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Recipe.java
index b4ce8bf2..ab7b5737 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Recipe.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Recipe.java
@@ -17,10 +17,8 @@ import ntnu.idatt2016.v233.SmartMat.entity.user.User;
 /**
  * Recipe is an entity class representing a recipe in the system.
  *
- * @author Anders & Stian + Birk
- * @version 1.1
- * @since 25.04.2023
- *
+ * @author Anders, Stian, Birk
+ * @version 1.7
  */
 
 @NoArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/ShoppingList.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/ShoppingList.java
index 339e86cf..1a816673 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/ShoppingList.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/ShoppingList.java
@@ -14,10 +14,8 @@ import java.util.List;
 /**
  * This class represents a shopping list
  * 
- * @author Stian Lyng and Anders
- * @version 1.0.001
- * @since 19.04.2023
- *
+ * @author Stian Lyng, Anders, Birk
+ * @version 1.3
  */
 
 @NoArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Waste.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Waste.java
index 567f074c..716a3db2 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Waste.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/Waste.java
@@ -15,10 +15,8 @@ import java.sql.Timestamp;
 /**
  * This class represents a waste made by a group.
  *
- * @author Stian Lyng and Anders
- * @version 1.0.001
- * @since 19.04.2023
- *
+ * @author Anders, Birk, Pedro
+ * @version 1.3
  */
 
 @NoArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/fridgeProduct/FridgeProductAsso.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/fridgeProduct/FridgeProductAsso.java
index eb660c49..368ce1c6 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/fridgeProduct/FridgeProductAsso.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/fridgeProduct/FridgeProductAsso.java
@@ -11,6 +11,12 @@ import ntnu.idatt2016.v233.SmartMat.entity.product.Product;
 
 import java.sql.Date;
 
+/**
+ * FridgeProductAsso is an entity class representing a fridge product association.
+ *
+ * @author Birk, Pedro
+ * @version 1.1
+ */
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Achievement.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Achievement.java
index 1e692d3a..28fe3d04 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Achievement.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Achievement.java
@@ -14,9 +14,8 @@ import java.util.List;
 /**
  * Achievement is an entity class representing an achievement in the system.
  *
- * @author Anders
- * @version 1.0
- * @since 19.04.2023
+ * @author Anders, Birk
+ * @version 1.1
  *
  */
 
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Fridge.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Fridge.java
index 537c6402..0e07d4b6 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Fridge.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Fridge.java
@@ -20,7 +20,6 @@ import org.hibernate.annotations.OnDeleteAction;
  *
  * @author Anders & Birk
  * @version 1.2
- * @since 25.04.2023
  */
 
 @NoArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Group.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Group.java
index 9a87de61..ad150509 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Group.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/Group.java
@@ -16,11 +16,10 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Group is an entity class representing a group in the system.
+ * Group is an entity class representing a user group in the system.
  *
- * @author Stian Lyng, Anders Austlid
- * @version 1.0.1
- * @since 20.04.2023
+ * @author Stian Lyng, Anders Austlid, Birk, Pedro
+ * @version 1.3
  */
 
 @NoArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupAsso.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupAsso.java
index cf3b0fca..e60d36b4 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupAsso.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupAsso.java
@@ -9,9 +9,8 @@ import ntnu.idatt2016.v233.SmartMat.entity.user.User;
 /**
  * UserGroupTable is a class representing the user_group table in the database.
  * It is used to represent the many-to-many relationship between users and groups.
- * @Author Birk
- * @Version 1.0
- * @Since 25.04
+ * @Author Birk, Pedro
+ * @Version 1.2
  */
 @Entity
 @AllArgsConstructor
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupId.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupId.java
index a9698b22..9eec6d34 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupId.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/group/UserGroupId.java
@@ -10,6 +10,12 @@ import lombok.NoArgsConstructor;
 import java.io.Serializable;
 import java.util.Objects;
 
+/**
+ * This class represents a user group id
+ *
+ * @author Birk
+ * @version 1.0
+ */
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
@@ -21,7 +27,6 @@ public class UserGroupId implements Serializable {
     @Column(name = "group_id")
     private long groupId;
 
-
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Allergy.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Allergy.java
index b3b87d9a..79ffc537 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Allergy.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Allergy.java
@@ -17,8 +17,6 @@ import java.util.List;
  * 
  * @author Stian Lyng and Anders
  * @version 1.3
- * @since 24.04.2023
- *
  */
 
 @NoArgsConstructor
@@ -62,6 +60,10 @@ public class Allergy{
 
     }
 
+    /**
+     * adds a product to the allergy
+     * @param product adds a product to the list of products with this allergy
+     */
     public void addProduct(Product product) {
         if (products == null)
             products = new ArrayList<>();
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Category.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Category.java
index d460d915..aef8bfaf 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Category.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Category.java
@@ -10,6 +10,12 @@ import lombok.NoArgsConstructor;
 
 import java.util.List;
 
+/**
+ * Category is an entity class representing a product category
+ *
+ * @author Pedro, Birk
+ * @version 1.1
+ */
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder
@@ -26,6 +32,10 @@ public class Category {
     @JsonIgnore
     private List<Product> products;
 
+    /**
+     * adds a product to the category
+     * @param product adds a product to the list of products in this category
+     */
     public void addProduct(Product product) {
         if (products == null)
             products = List.of(product);
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Product.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Product.java
index 45efc15f..febadac7 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Product.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/product/Product.java
@@ -22,9 +22,8 @@ import java.util.List;
  * Product is an entity class representing a product in the system.
  * All other info about the product is fetched from api call on fronted.
  * this ensures that the product is always up to date.
- * @author Birk and Anders
- * @version 1.1.001
- * @since 19.04.2023
+ * @author Birk, Anders, Pedro
+ * @version 1.4
  */
 @Data
 @NoArgsConstructor
@@ -116,6 +115,10 @@ public class Product{
         shoppingLists.add(shoppingList);
     }
 
+    /**
+     * Adds an allergy to the product
+     * @param allergy the allergy to add to the product
+     */
     public void addAllergy(Allergy allergy){
         if (allergies == null){
             allergies = new ArrayList<>();
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/user/User.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/user/User.java
index 4129c444..ff2635a7 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/user/User.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/entity/user/User.java
@@ -20,10 +20,8 @@ import java.util.*;
  * User is a class representing a user in the system.
  * It implements the UserDetails interface.
  *
- * @author Anders and Birk
+ * @author Anders, Birk, Pedro
  * @version 2.0.3
- * @since 25.04.2023
- *
  */
 
 @Data
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/FridgeRepository.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/FridgeRepository.java
index 8d8ed7de..fe270076 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/FridgeRepository.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/FridgeRepository.java
@@ -5,6 +5,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
 
 import java.util.Optional;
 
+/**
+ * Repository interface for the Fridge entity
+ *
+ * @author Anders, Birk
+ * @version 1.1
+ */
 public interface FridgeRepository extends JpaRepository<Fridge, Long> {
     /**
      * Gets the fridge of a group
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/GroupRepository.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/GroupRepository.java
index e1f32784..42fb031f 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/GroupRepository.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/group/GroupRepository.java
@@ -14,9 +14,8 @@ import java.util.Optional;
 /**
  * Repository for groups
  * 
- * @author Stian Lyng, Anders Austlid
+ * @author Stian Lyng, Anders Austlid, Pedro Cardona
  * @version 1.3
- * @since 24.04.2023
  */
 public interface GroupRepository extends JpaRepository<Group, Long> {
     /**
@@ -42,11 +41,25 @@ public interface GroupRepository extends JpaRepository<Group, Long> {
      */
     Optional<Group> findByGroupId(long id);
 
+    /**
+     * Gets link codes of all groups
+     * @return a list of all link codes
+     */
     @Query(value = "SELECT link_code FROM  groups", nativeQuery = true)
     List<String> findAllLinkCode();
 
+    /**
+     * Gets a group with a given link code
+     * @param linkCode the link code of the group
+     * @return the group with the given link code if it exists
+     */
     Optional<Group> findByLinkCode(String linkCode);
 
+    /**
+     * Gets the amount of users in a group with a given group id
+     * @param groupId the id of the group
+     * @return the amount of users in the group
+     */
     @Query(value = "SELECT count(*) FROM user_group where group_id = :groupId", nativeQuery = true)
     int countAllUserInGroup(@Param("groupId") long groupId);
 
-- 
GitLab