Skip to content
Snippets Groups Projects
Commit b4f8179c authored by Stian Lyng's avatar Stian Lyng
Browse files

add javadoc

parent cfa53305
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,13 @@ public interface RecipeRepository extends JpaRepository<Recipe, Long> {
*/
List<Recipe> findAllByName(String name);
/**
* Finds the top 5 recipes with products that have a match with items in the given fridge.
* Returns a list of Object arrays, where each array contains the recipe details and product information.
*
* @param fridgeId the ID of the fridge to use for matching products
* @return a list of Object arrays with recipe and product details
*/
@Query(value = """
WITH fridge_products AS (
SELECT ean
......
......@@ -9,13 +9,23 @@ import ntnu.idatt2016.v233.SmartMat.repository.RecipeRepository;
/**
* Service class for weekly menu
*
* @author Stian Lyng
* @version 1.0
*/
@Service
public class WeeklyMenuService {
@Autowired
RecipeRepository recipeRepository;
/**
* Retrieves the top 5 recipes with products that have a match with items in the given fridge.
* Returns a list of Object arrays, where each array contains the recipe details and product information.
*
* @param groupId the ID of the fridge to use for matching products
* @return a list of Object arrays with recipe and product details
*/
public List<Object[]> getTop5RecipesWithProducts(long groupId) {
return recipeRepository.findTop5RecipesWithProducts(groupId);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment