diff --git a/src/main/java/com/bookmile/backend/domain/book/entity/Book.java b/src/main/java/com/bookmile/backend/domain/book/entity/Book.java index 69611ef..44f4b77 100644 --- a/src/main/java/com/bookmile/backend/domain/book/entity/Book.java +++ b/src/main/java/com/bookmile/backend/domain/book/entity/Book.java @@ -12,12 +12,14 @@ import java.util.ArrayList; import java.util.List; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class Book extends BaseEntity { @Id @@ -54,4 +56,15 @@ public class Book extends BaseEntity { @Column(nullable = false) private Boolean isDeleted = false; + + public Book(String bookName, Integer page, String thumbNail, String publisher, String description, String link, + Double rating) { + this.bookName = bookName; + this.page = page; + this.thumbNail = thumbNail; + this.publisher = publisher; + this.description = description; + this.link = link; + this.rating = rating; + } } diff --git a/src/main/java/com/bookmile/backend/domain/checkpoint/entity/CheckPoint.java b/src/main/java/com/bookmile/backend/domain/checkpoint/entity/CheckPoint.java index 825d049..60c68c7 100644 --- a/src/main/java/com/bookmile/backend/domain/checkpoint/entity/CheckPoint.java +++ b/src/main/java/com/bookmile/backend/domain/checkpoint/entity/CheckPoint.java @@ -13,12 +13,14 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToOne; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class CheckPoint { @Id @@ -33,5 +35,11 @@ public class CheckPoint { @Enumerated(EnumType.STRING) private Type type; - private String FreeType; + private String freeType; + + public CheckPoint(Group group, Type type, String freeType) { + this.group = group; + this.type = type; + this.freeType = freeType; + } } diff --git a/src/main/java/com/bookmile/backend/domain/group/entity/Group.java b/src/main/java/com/bookmile/backend/domain/group/entity/Group.java index 8625113..3163ef5 100644 --- a/src/main/java/com/bookmile/backend/domain/group/entity/Group.java +++ b/src/main/java/com/bookmile/backend/domain/group/entity/Group.java @@ -17,12 +17,14 @@ import java.util.ArrayList; import java.util.List; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class Group extends BaseEntity { @Id @@ -57,4 +59,17 @@ public class Group extends BaseEntity { @Column(nullable = false) private Boolean isDeleted = false; + + public Group(Book book, List userGroup, CheckPoint checkPoint, String groupName, String description, + Long code, Boolean isOpen, Boolean isEnd) { + this.book = book; + this.userGroup = userGroup; + this.checkPoint = checkPoint; + this.groupName = groupName; + this.description = description; + this.code = code; + this.isOpen = isOpen; + this.isEnd = isEnd; + } } + diff --git a/src/main/java/com/bookmile/backend/domain/image/entity/Image.java b/src/main/java/com/bookmile/backend/domain/image/entity/Image.java index d25e088..36b416f 100644 --- a/src/main/java/com/bookmile/backend/domain/image/entity/Image.java +++ b/src/main/java/com/bookmile/backend/domain/image/entity/Image.java @@ -7,12 +7,14 @@ import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class Image extends BaseEntity { @Id @@ -20,6 +22,10 @@ public class Image extends BaseEntity { @Column(name = "image_id") private Long id; - @Column + @Column(nullable = false) private String imageUrl; + + public Image(String imageUrl) { + this.imageUrl = imageUrl; + } } diff --git a/src/main/java/com/bookmile/backend/domain/record/entity/Record.java b/src/main/java/com/bookmile/backend/domain/record/entity/Record.java index a3447e7..940e3bd 100644 --- a/src/main/java/com/bookmile/backend/domain/record/entity/Record.java +++ b/src/main/java/com/bookmile/backend/domain/record/entity/Record.java @@ -12,12 +12,14 @@ import java.util.ArrayList; import java.util.List; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class Record extends BaseEntity { @Id @@ -34,4 +36,9 @@ public class Record extends BaseEntity { @Column(nullable = false) private Integer currentPage; + + public Record(String text, Integer currentPage) { + this.text = text; + this.currentPage = currentPage; + } } diff --git a/src/main/java/com/bookmile/backend/domain/review/entity/Review.java b/src/main/java/com/bookmile/backend/domain/review/entity/Review.java index e8301a8..4b94281 100644 --- a/src/main/java/com/bookmile/backend/domain/review/entity/Review.java +++ b/src/main/java/com/bookmile/backend/domain/review/entity/Review.java @@ -12,12 +12,14 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class Review extends BaseEntity { @Id @@ -41,4 +43,11 @@ public class Review extends BaseEntity { @Column(nullable = false) private Boolean isDeleted = false; + + public Review(User user, Book book, Double rating, String text) { + this.user = user; + this.book = book; + this.rating = rating; + this.text = text; + } } diff --git a/src/main/java/com/bookmile/backend/domain/user/entity/User.java b/src/main/java/com/bookmile/backend/domain/user/entity/User.java index 57d966c..8a8e7c0 100644 --- a/src/main/java/com/bookmile/backend/domain/user/entity/User.java +++ b/src/main/java/com/bookmile/backend/domain/user/entity/User.java @@ -12,12 +12,14 @@ import java.util.ArrayList; import java.util.List; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class User extends BaseEntity { @Id @@ -50,4 +52,11 @@ public void addUserGroup(UserGroup userGroup) { this.userGroup.add(userGroup); userGroup.addUser(this); } + + public User(String name, String email, String password, String image) { + this.name = name; + this.email = email; + this.password = password; + this.image = image; + } } diff --git a/src/main/java/com/bookmile/backend/domain/userGroup/entity/UserGroup.java b/src/main/java/com/bookmile/backend/domain/userGroup/entity/UserGroup.java index bc59536..84d8707 100644 --- a/src/main/java/com/bookmile/backend/domain/userGroup/entity/UserGroup.java +++ b/src/main/java/com/bookmile/backend/domain/userGroup/entity/UserGroup.java @@ -19,12 +19,14 @@ import java.util.ArrayList; import java.util.List; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor public class UserGroup extends BaseEntity { @Id @@ -55,7 +57,9 @@ public void addUser(User user) { this.user = user; } - public void addGroup(Group group) { + public UserGroup(User user, Group group, Role role) { + this.user = user; this.group = group; + this.role = role; } }