diff --git a/Server/banchango/src/main/java/com/sundaegukbap/banchango/ingredient/domain/RecipeMainIngredient.java b/Server/banchango/src/main/java/com/sundaegukbap/banchango/ingredient/domain/RecipeMainIngredient.java new file mode 100644 index 0000000..e03495f --- /dev/null +++ b/Server/banchango/src/main/java/com/sundaegukbap/banchango/ingredient/domain/RecipeMainIngredient.java @@ -0,0 +1,38 @@ +package com.sundaegukbap.banchango.ingredient.domain; + +import com.sundaegukbap.banchango.recipe.domain.Recipe; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name="recipe_main_ingredients") +public class RecipeMainIngredient { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="recipe_id") + private Recipe recipe; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="ingredient_id") + private Ingredient ingredient; + + @Builder + public RecipeMainIngredient(Long id, Recipe recipe, Ingredient ingredient) { + this.id = id; + this.recipe = recipe; + this.ingredient = ingredient; + } +} diff --git a/Server/banchango/src/main/java/com/sundaegukbap/banchango/recipe/domain/Recipe.java b/Server/banchango/src/main/java/com/sundaegukbap/banchango/recipe/domain/Recipe.java index 3ad10aa..94420da 100644 --- a/Server/banchango/src/main/java/com/sundaegukbap/banchango/recipe/domain/Recipe.java +++ b/Server/banchango/src/main/java/com/sundaegukbap/banchango/recipe/domain/Recipe.java @@ -1,20 +1,19 @@ package com.sundaegukbap.banchango.recipe.domain; -import com.sundaegukbap.banchango.bookmark.domain.RecipeBookmark; -import com.sundaegukbap.banchango.ingredient.domain.Ingredient; -import com.sundaegukbap.banchango.ingredient.domain.RecipeRequiringIngredient; -import com.sundaegukbap.banchango.user.domain.User; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -25,6 +24,7 @@ public class Recipe { private Long id; @NotNull private String name; + private String bestName; @NotNull @Column(length=2048) private String introduction; @@ -40,16 +40,24 @@ public class Recipe { @NotNull @Enumerated(EnumType.STRING) private Difficulty difficulty; + private String bySort; + private String byIngredient; + private String bySituation; @Builder - public Recipe(Long id, String name, String introduction, String image1, String link, int servings, int cookingTime, Difficulty difficulty) { + public Recipe(Long id, String name, String bestName, String introduction, String image1, String image2, String link, int servings, int cookingTime, Difficulty difficulty, String bySort, String byIngredient, String bySituation) { this.id = id; this.name = name; + this.bestName = bestName; this.introduction = introduction; this.image1 = image1; + this.image2 = image2; this.link = link; this.servings = servings; this.cookingTime = cookingTime; this.difficulty = difficulty; + this.bySort = bySort; + this.byIngredient = byIngredient; + this.bySituation = bySituation; } }