refactor to setters TODO, ingredientController

This commit is contained in:
Mei Chang van der Werff 2025-12-18 03:35:47 +01:00
commit fef20ec876
2 changed files with 5 additions and 2 deletions

View file

@ -50,6 +50,10 @@ public class Ingredient {
+ carbsPer100g * KCAL_PER_GRAM_CARBS + carbsPer100g * KCAL_PER_GRAM_CARBS
+ fatPer100g * KCAL_PER_GRAM_FAT; + fatPer100g * KCAL_PER_GRAM_FAT;
} }
public void setId(long id) {
this.id = id;
}
} }

View file

@ -134,8 +134,7 @@ public class IngredientController {
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
// TODO: Refactor to use setters updated.setId(id);
updated.id = id;
Ingredient savedIngredient = ingredientRepository.save(updated); Ingredient savedIngredient = ingredientRepository.save(updated);
messagingTemplate.convertAndSend(Topics.INGREDIENTS, new CreateIngredientMessage(savedIngredient)); messagingTemplate.convertAndSend(Topics.INGREDIENTS, new CreateIngredientMessage(savedIngredient));