-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
controller, service, converter, repository까지 작업 완
- Loading branch information
Showing
20 changed files
with
900 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/zipdabang/server/domain/test/TestComment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package zipdabang.server.domain.test; | ||
|
||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import zipdabang.server.domain.common.BaseEntity; | ||
import zipdabang.server.domain.member.Member; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
@DynamicUpdate | ||
public class TestComment extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(nullable = false) | ||
private Long id; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String content; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id", nullable = false) | ||
private Member member; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "recipe_id", nullable = false) | ||
private TestRecipe recipe; | ||
|
||
public TestComment updateContent(String content) { | ||
this.content = content; | ||
return this; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/zipdabang/server/domain/test/TestIngredient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package zipdabang.server.domain.test; | ||
|
||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import zipdabang.server.domain.common.BaseEntity; | ||
import zipdabang.server.domain.recipe.Recipe; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
@DynamicUpdate | ||
public class TestIngredient extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(nullable = false) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String name; | ||
|
||
@Column(length = 100, nullable = false) | ||
private String quantity; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "recipe_id", nullable = false) | ||
private TestRecipe recipe; | ||
|
||
public TestIngredient setRecipe(TestRecipe recipe){ | ||
if(this.recipe != null) | ||
recipe.getIngredientList().remove(this); | ||
this.recipe = recipe; | ||
recipe.getIngredientList().add(this); | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package zipdabang.server.domain.test; | ||
|
||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import zipdabang.server.domain.common.BaseEntity; | ||
import zipdabang.server.domain.member.Member; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DynamicInsert | ||
@DynamicUpdate | ||
public class TestLikes extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(nullable = false) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id", nullable = false) | ||
private Member member; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "recipe_id", nullable = false) | ||
private TestRecipe recipe; | ||
|
||
public TestLikes deleteLikes(TestRecipe recipe){ | ||
if(this.recipe != null) | ||
recipe.getLikesList().remove(this); | ||
recipe.updateLike(-1); | ||
return this; | ||
} | ||
|
||
public TestLikes setRecipe(TestRecipe recipe){ | ||
|
||
recipe.updateLike(1); | ||
|
||
if(this.recipe != null) | ||
recipe.getLikesList().remove(this); | ||
this.recipe = recipe; | ||
recipe.getLikesList().add(this); | ||
|
||
return this; | ||
} | ||
} |
Oops, something went wrong.