perf(CreateRecipe): añadida en el servicio referencia a la receta en los ingredientes y pasos

parent dfea2798
...@@ -22,6 +22,10 @@ public class CreateRecipeUseCaseImpl implements CreateRecipeUseCase { ...@@ -22,6 +22,10 @@ public class CreateRecipeUseCaseImpl implements CreateRecipeUseCase {
@Override @Override
public RecipeOutputDto create(RecipeInputDto recipeInputDto) { public RecipeOutputDto create(RecipeInputDto recipeInputDto) {
RecipeJpa recipeJpa = mapper.mapJpa(mapper.map(recipeInputDto)); RecipeJpa recipeJpa = mapper.mapJpa(mapper.map(recipeInputDto));
recipeJpa.getSteps().forEach(step -> {step.setRecipe(recipeJpa);});
recipeJpa.getIngredients().forEach(ingredient -> {ingredient.setRecipe(recipeJpa);});
RecipeJpa savedRecipe = repository.create(recipeJpa); RecipeJpa savedRecipe = repository.create(recipeJpa);
return mapper.map(mapper.mapJpa(savedRecipe)); return mapper.map(mapper.mapJpa(savedRecipe));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment