got rid of odd duplicate lines

This commit is contained in:
durn
2026-04-21 18:24:46 -06:00
parent e84ec7b0eb
commit 69d823c977
2 changed files with 27 additions and 9 deletions
@@ -1,6 +1,8 @@
package com.example.demo.entity;
import jakarta.persistence.*;
import java.util.List;
import java.util.ArrayList;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@@ -56,11 +58,13 @@ public class Recipe {
// Recipe ingredients relationship
@OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@NotEmpty(message = "At least one ingredient is required")
private Set<RecipeIngredient> recipeIngredients = new HashSet<>();
@OrderBy("orderIndex ASC")
private List<RecipeIngredient> recipeIngredients = new ArrayList<>();
// Recipe Steps relationship
@OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
private Set<Step> steps = new HashSet<>();
@OrderBy("stepNumber ASC")
private List<Step> steps = new ArrayList<>();
// Recipe Images relationship
@OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@@ -172,21 +176,22 @@ public class Recipe {
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
this.updatedAt = updatedAt;
}
public Set<RecipeIngredient> getRecipeIngredients() {
public List<RecipeIngredient> getRecipeIngredients(){
return recipeIngredients;
}
public void setRecipeIngredients(Set<RecipeIngredient> recipeIngredients) {
public void setRecipeIngredients(List<RecipeIngredient> recipeIngredients) {
this.recipeIngredients = recipeIngredients;
}
public Set<Step> getSteps() {
public List<Step> getSteps(){
return steps;
}
public void setSteps(Set<Step> steps) {
public void setSteps(List<Step> steps) {
this.steps = steps;
}
@@ -221,4 +226,4 @@ public class Recipe {
public void setCost(Integer cost) {
this.cost = cost;
}
}
}