Skip to content

Commit

Permalink
🐛 Refactor/296 peek() -> collect().stream().map()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanvp committed Feb 4, 2024
1 parent 8c8b8b2 commit c5c0061
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -913,16 +913,22 @@ public TestRecipe testCreate(RecipeRequestDto.CreateRecipeDto request, Multipart

RecipeConverter.toTestRecipeCategory(request.getCategoryId(),recipe).stream()
.map(categoryMapping -> testRecipeCategoryMappingRepository.save(categoryMapping))
.peek(categoryMapping -> categoryMapping.setRecipe(recipe));
.collect(Collectors.toList())
.stream()
.map(categoryMapping -> categoryMapping.setRecipe(recipe));


RecipeConverter.toTestStep(request, recipe, stepImages).stream()
.map(step -> testStepRepository.save(step))
.peek(step -> step.setRecipe(recipe));
.collect(Collectors.toList())
.stream()
.map(step -> step.setRecipe(recipe));

RecipeConverter.toTestIngredient(request, recipe).stream()
.map(ingredient -> testIngredientRepository.save(ingredient))
.peek(ingredient -> ingredient.setRecipe(recipe));
.collect(Collectors.toList())
.stream()
.map(ingredient -> ingredient.setRecipe(recipe));

return recipe;
}
Expand Down

0 comments on commit c5c0061

Please sign in to comment.