Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -577,20 +577,26 @@ public RecipeRecommendResponse getRandomRecipe() {
int randomIndex = random.nextInt(allRecipes.size());
Recipe selectedRecipe = allRecipes.get(randomIndex);

// Response 객체로 변환
RecipeRecommendResponse response = mapper.map(selectedRecipe, RecipeRecommendResponse.class);
// 로그 추가
System.out.println("선택된 레시피: " + selectedRecipe.getRecipeName());

// 재료 정보 추가
List<RecipeIngredient> recipeIngredients = recipeIngredientRepository.findByRecipe(selectedRecipe);
// 로그 추가
System.out.println("조회된 재료 수: " + recipeIngredients.size());

List<RecipeIngredientInfo> ingredientInfoList = recipeIngredients.stream()
.map(ri -> {
// 로그 추가
System.out.println("재료 정보: " + ri.getIngredientManagement().getIngredientName());

RecipeIngredientInfo info = new RecipeIngredientInfo();
info.setIngredientName(ri.getIngredientManagement().getIngredientName());
info.setNecessary(ri.isIngredientIsNecessary());
return info;
})
.collect(Collectors.toList());

RecipeRecommendResponse response = mapper.map(selectedRecipe, RecipeRecommendResponse.class);
response.setIngredients(ingredientInfoList);

return response;
Expand Down