Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server] 엔티티 수정(#47) #48

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -25,6 +24,7 @@ public class Recipe {
private Long id;
@NotNull
private String name;
private String bestName;
@NotNull
@Column(length=2048)
private String introduction;
Expand All @@ -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;
}
}