fixed todo delete progatation in recipe

added count to IngredientController about what recipes we have or dont and 2 small typo mistakes

also added counting ingredients to IngredientService
This commit is contained in:
Aysegul 2026-01-08 22:06:45 +01:00
commit 16c8d4c6dc
3 changed files with 43 additions and 14 deletions

View file

@ -15,6 +15,7 @@
*/
package commons;
import jakarta.persistence.CascadeType;
import jakarta.persistence.CollectionTable;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
@ -60,7 +61,7 @@ public class Recipe {
// | 1 (Steak) | 40g pepper |
// | 1 (Steak) | Meat |
// |----------------------------------|
@OneToMany
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@CollectionTable(name = "recipe_ingredients", joinColumns = @JoinColumn(name = "recipe_id"))
@Column(name = "ingredient")
// TODO: Replace String with Embeddable Ingredient Class