diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/FarmClub.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/FarmClub.java new file mode 100644 index 00000000..12b89b69 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/FarmClub.java @@ -0,0 +1,69 @@ +package com.modernfarmer.farmusspring.domain.farmclub.entity; + +import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.Diary; +import com.modernfarmer.farmusspring.global.common.BaseEntity; +import jakarta.persistence.*; +import lombok.*; +import lombok.experimental.SuperBuilder; +import org.joda.time.LocalDate; + +import java.util.ArrayList; +import java.util.List; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +@SuperBuilder +@Entity(name = "farm_club") +public class FarmClub extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "farm_club_id") + private Long id; + + @Column(nullable = false) + private String veggieInfoId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private String description; + + @Column(nullable = false) + private String difficulty; + + @Column(nullable = false) + private int maxUser; + + @Column(nullable = false) + private LocalDate startedAt; + + @OneToMany(mappedBy = "farmClub") + @Builder.Default + private List userFarmClubs = new ArrayList<>(); + + @OneToMany(mappedBy = "farmClub") + @Builder.Default + private List diaries = new ArrayList<>(); + + public static FarmClub createFarmClub(String veggieInfoId, String name, String description, String difficulty, int maxUser, LocalDate startedAt){ + return FarmClub.builder() + .veggieInfoId(veggieInfoId) + .name(name) + .description(description) + .difficulty(difficulty) + .maxUser(maxUser) + .startedAt(startedAt) + .build(); + } + + public void addUserFarmClub(UserFarmClub userFarmClub){ + this.userFarmClubs.add(userFarmClub); + } + + public void addDiary(Diary diary){ + this.diaries.add(diary); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPost.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPost.java new file mode 100644 index 00000000..68661129 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPost.java @@ -0,0 +1,64 @@ +package com.modernfarmer.farmusspring.domain.farmclub.entity; + +import com.modernfarmer.farmusspring.global.common.BaseEntity; +import jakarta.persistence.*; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.util.ArrayList; +import java.util.List; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +@SuperBuilder +@Entity(name = "mission_post") +public class MissionPost extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "mission_post_id") + private Long id; + + @Column(nullable = false) + private String content; + + @Column(nullable = false) + private Long step_num; + + @Column(nullable = false) + private String image; + + @OneToMany(mappedBy = "missionPost", cascade = CascadeType.REMOVE) + @Builder.Default + private List missionPostLikes = new ArrayList<>(); + + @OneToMany(mappedBy = "missionPost", cascade = CascadeType.REMOVE) + @Builder.Default + private List missionPostComments = new ArrayList<>(); + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_farm_club_id") + private UserFarmClub userFarmClub; + + public static MissionPost createMissionPost(String content, Long step_num, String image, UserFarmClub userFarmClub){ + MissionPost newMissionPost = MissionPost.builder() + .content(content) + .step_num(step_num) + .image(image) + .userFarmClub(userFarmClub) + .build(); + + userFarmClub.addMissionPost(newMissionPost); + + return newMissionPost; + } + + public void addLike(MissionPostLike missionPostLike) { + missionPostLikes.add(missionPostLike); + } + + public void addComment(MissionPostComment missionPostComment) { + missionPostComments.add(missionPostComment); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostComment.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostComment.java new file mode 100644 index 00000000..e40fce3c --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostComment.java @@ -0,0 +1,47 @@ +package com.modernfarmer.farmusspring.domain.farmclub.entity; + +import com.modernfarmer.farmusspring.domain.user.entity.User; +import com.modernfarmer.farmusspring.global.common.BaseEntity; +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +@SuperBuilder +@Entity(name = "mission_post_comment") +public class MissionPostComment extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "mission_post_comment_id") + private Long id; + + @Column(nullable = false) + private String comment; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "mission_post_id") + private MissionPost missionPost; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + public static MissionPostComment createMissionPostComment(String comment, MissionPost missionPost, User user){ + MissionPostComment newMissionPostComment = MissionPostComment.builder() + .comment(comment) + .missionPost(missionPost) + .user(user) + .build(); + + missionPost.addComment(newMissionPostComment); + user.addMissionPostComment(newMissionPostComment); + + return newMissionPostComment; + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostLike.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostLike.java new file mode 100644 index 00000000..1b7eb034 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostLike.java @@ -0,0 +1,43 @@ +package com.modernfarmer.farmusspring.domain.farmclub.entity; + +import com.modernfarmer.farmusspring.domain.user.entity.User; +import com.modernfarmer.farmusspring.global.common.BaseEntity; +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +@SuperBuilder +@Entity(name = "mission_post_like") +public class MissionPostLike extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "mission_post_like_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "mission_post_id") + private MissionPost missionPost; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + public static MissionPostLike createMissionPostLike(MissionPost missionPost, User user){ + MissionPostLike newMissionPostLike = MissionPostLike.builder() + .missionPost(missionPost) + .user(user) + .build(); + + missionPost.addLike(newMissionPostLike); + user.addMissionPostLike(newMissionPostLike); + + return newMissionPostLike; + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java new file mode 100644 index 00000000..a4e3741f --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java @@ -0,0 +1,68 @@ +package com.modernfarmer.farmusspring.domain.farmclub.entity; + +import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.MyVeggie; +import com.modernfarmer.farmusspring.global.common.BaseEntity; +import jakarta.persistence.*; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.util.ArrayList; +import java.util.List; + +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +@SuperBuilder +@Entity(name = "user_farm_club") +public class UserFarmClub extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "user_farm_club_id") + private Long id; + + @Column(name = "user_id", nullable = false) + private Long userId; + + @Column(nullable = false) + private int currentStep; + + @Column(nullable = false) + private String currentStepName; + + @OneToMany(mappedBy = "userFarmClub", cascade = CascadeType.REMOVE) + @Builder.Default + private List missionPosts = new ArrayList<>(); + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "farm_club_id") + private FarmClub farmClub; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "my_veggie_id") + private MyVeggie myVeggie; + + public static UserFarmClub createUserFarmClub(Long userId, int currentStep, String currentStepName, FarmClub farmClub, MyVeggie myVeggie){ + UserFarmClub newUserFarmClub = UserFarmClub.builder() + .userId(userId) + .currentStep(currentStep) + .currentStepName(currentStepName) + .farmClub(farmClub) + .myVeggie(myVeggie) + .build(); + + farmClub.addUserFarmClub(newUserFarmClub); + myVeggie.setUserFarmClub(newUserFarmClub); + + return newUserFarmClub; + } + + public void updateCurrentStep(int currentStep, String currentStepName){ + this.currentStep = currentStep; + this.currentStepName = currentStepName; + } + + public void addMissionPost(MissionPost missionPost){ + this.missionPosts.add(missionPost); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/controller/TestController.java b/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/controller/TestController.java deleted file mode 100644 index b63fe496..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/controller/TestController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.controller; - -public class TestController { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/dto/TestDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/dto/TestDto.java deleted file mode 100644 index b1891871..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/dto/TestDto.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.dto; - -public class TestDto { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/repository/TestRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/repository/TestRepository.java deleted file mode 100644 index a0142532..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/repository/TestRepository.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.repository; - -public class TestRepository { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/service/TestService.java b/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/service/TestService.java deleted file mode 100644 index 8b9703f4..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/service/TestService.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.service; - -public class TestService { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/TestController.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/TestController.java new file mode 100644 index 00000000..8d7db573 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/TestController.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.myveggiegarden.controller; + +public class TestController { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/TestDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/TestDto.java new file mode 100644 index 00000000..94f24356 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/TestDto.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.myveggiegarden.dto; + +public class TestDto { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Diary.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Diary.java similarity index 78% rename from src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Diary.java rename to src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Diary.java index 9beb0fe7..62461175 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Diary.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Diary.java @@ -1,6 +1,7 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.entity; +package com.modernfarmer.farmusspring.domain.myveggiegarden.entity; +import com.modernfarmer.farmusspring.domain.farmclub.entity.FarmClub; import com.modernfarmer.farmusspring.global.common.BaseEntity; import jakarta.persistence.*; import lombok.*; @@ -37,8 +38,8 @@ public class Diary extends BaseEntity { private String state; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "my_vegetable_id") - private MyVegetable myVegetable; + @JoinColumn(name = "my_veggie_id") + private MyVeggie myVeggie; @OneToMany(mappedBy = "diary", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default @@ -48,18 +49,20 @@ public class Diary extends BaseEntity { @Builder.Default private List diaryLikes = new ArrayList<>(); + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "farm_club_id") + private FarmClub farmClub; - - public static Diary createDiary(String content, Boolean isOpen, String image, String state, MyVegetable myVegetable){ + public static Diary createDiary(String content, Boolean isOpen, String image, String state, MyVeggie myVeggie){ Diary newDiary = Diary.builder() .content(content) .isOpen(isOpen) .image(image) .state(state) - .myVegetable(myVegetable) + .myVeggie(myVeggie) .build(); - myVegetable.addDiary(newDiary); + myVeggie.addDiary(newDiary); return newDiary; diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryComment.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryComment.java similarity index 94% rename from src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryComment.java rename to src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryComment.java index 53ff7c88..8f9ceb27 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryComment.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryComment.java @@ -1,4 +1,4 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.entity; +package com.modernfarmer.farmusspring.domain.myveggiegarden.entity; import com.modernfarmer.farmusspring.domain.user.entity.User; import com.modernfarmer.farmusspring.global.common.BaseEntity; diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryLike.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryLike.java similarity index 93% rename from src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryLike.java rename to src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryLike.java index b52f1017..3d689b55 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/DiaryLike.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/DiaryLike.java @@ -1,4 +1,4 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.entity; +package com.modernfarmer.farmusspring.domain.myveggiegarden.entity; import com.modernfarmer.farmusspring.domain.user.entity.User; import com.modernfarmer.farmusspring.global.common.BaseEntity; diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/MyVegetable.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java similarity index 53% rename from src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/MyVegetable.java rename to src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java index c6626477..fe3a33bc 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/MyVegetable.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java @@ -1,5 +1,6 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.entity; +package com.modernfarmer.farmusspring.domain.myveggiegarden.entity; +import com.modernfarmer.farmusspring.domain.farmclub.entity.UserFarmClub; import com.modernfarmer.farmusspring.domain.user.entity.User; import com.modernfarmer.farmusspring.global.common.BaseEntity; import jakarta.persistence.*; @@ -16,13 +17,13 @@ @AllArgsConstructor(access = AccessLevel.PRIVATE) @Getter @SuperBuilder -@Entity(name = "my_vegetable") -public class MyVegetable extends BaseEntity { +@Entity(name = "my_veggie") +public class MyVeggie extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "my_vegetable_id") + @Column(name = "my_veggie_id") private Long id; @Column(name = "veggie_nickname") @@ -31,33 +32,36 @@ public class MyVegetable extends BaseEntity { @Column(name = "birth") private Date birth; - @Column(name = "vegetable_id") - private String vegetableId; + @Column(name = "veggie_info_id") + private String veggieInfoId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") private User user; - @OneToMany(mappedBy = "myVegetable", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @OneToMany(mappedBy = "myVeggie", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List routines = new ArrayList<>(); - @OneToMany(mappedBy = "myVegetable", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @OneToMany(mappedBy = "myVeggie", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List diaries = new ArrayList<>(); + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_farm_club_id") + private UserFarmClub userFarmClub; - public static MyVegetable createMyVegetable(String nickname, Date birth, String vegetableId, User user){ - MyVegetable newMyVegetable= MyVegetable.builder() + public static MyVeggie createMyVegetable(String nickname, Date birth, String veggieInfoId, User user){ + MyVeggie newMyVeggie = MyVeggie.builder() .nickname(nickname) .birth(birth) - .vegetableId(vegetableId) + .veggieInfoId(veggieInfoId) .user(user) .build(); - user.addMyVegetable(newMyVegetable); + user.addMyVegetable(newMyVeggie); - return newMyVegetable; + return newMyVeggie; } @@ -69,4 +73,7 @@ public void addDiary(Diary diary) { diaries.add(diary); } + public void setUserFarmClub(UserFarmClub userFarmClub) { + this.userFarmClub = userFarmClub; + } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Routine.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Routine.java similarity index 79% rename from src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Routine.java rename to src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Routine.java index 3138edda..9fafe378 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myvegetablegarden/entity/Routine.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/Routine.java @@ -1,4 +1,4 @@ -package com.modernfarmer.farmusspring.domain.myvegetablegarden.entity; +package com.modernfarmer.farmusspring.domain.myveggiegarden.entity; import com.modernfarmer.farmusspring.global.common.BaseEntity; @@ -36,19 +36,19 @@ public class Routine extends BaseEntity { private int period; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "my_vegetable_id") - private MyVegetable myVegetable; + @JoinColumn(name = "my_veggie_id") + private MyVeggie myVeggie; - public static Routine createRoutine(Date date, String content, int period, MyVegetable myVegetable){ + public static Routine createRoutine(Date date, String content, int period, MyVeggie myVeggie){ Routine newRoutine = Routine.builder() .date(date) .content(content) .period(period) - .myVegetable(myVegetable) + .myVeggie(myVeggie) .build(); - myVegetable.addRoutine(newRoutine); + myVeggie.addRoutine(newRoutine); return newRoutine; } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/TestRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/TestRepository.java new file mode 100644 index 00000000..9e46b684 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/TestRepository.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.myveggiegarden.repository; + +public class TestRepository { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/TestService.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/TestService.java new file mode 100644 index 00000000..7cd1761a --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/TestService.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.myveggiegarden.service; + +public class TestService { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/user/entity/User.java b/src/main/java/com/modernfarmer/farmusspring/domain/user/entity/User.java index e1546d62..776c8d9f 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/user/entity/User.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/user/entity/User.java @@ -1,8 +1,10 @@ package com.modernfarmer.farmusspring.domain.user.entity; -import com.modernfarmer.farmusspring.domain.myvegetablegarden.entity.DiaryComment; -import com.modernfarmer.farmusspring.domain.myvegetablegarden.entity.DiaryLike; -import com.modernfarmer.farmusspring.domain.myvegetablegarden.entity.MyVegetable; +import com.modernfarmer.farmusspring.domain.farmclub.entity.MissionPostComment; +import com.modernfarmer.farmusspring.domain.farmclub.entity.MissionPostLike; +import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.DiaryComment; +import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.DiaryLike; +import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.MyVeggie; import com.modernfarmer.farmusspring.global.common.BaseEntity; import jakarta.persistence.*; import lombok.*; @@ -40,29 +42,33 @@ public class User extends BaseEntity { @Column(nullable = true) private String level; - @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List userFirebaseTokens = new ArrayList<>(); - @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List userMotivations = new ArrayList<>(); @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default - private List myVegetables = new ArrayList<>(); + private List myVeggies = new ArrayList<>(); @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List diaryComments = new ArrayList<>(); - @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @Builder.Default private List diaryLikes = new ArrayList<>(); + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @Builder.Default + private List missionPostComments = new ArrayList<>(); + + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @Builder.Default + private List missionPostLikes = new ArrayList<>(); public static User createUser(String role, int userNumber, String profileImage){ User newUser = User.builder() @@ -83,8 +89,8 @@ public void addUserMotivation(UserMotivation userMotivation) { userMotivations.add(userMotivation); } - public void addMyVegetable(MyVegetable myVegetable) { - myVegetables.add(myVegetable); + public void addMyVegetable(MyVeggie myVeggie) { + myVeggies.add(myVeggie); } public void addDiaryComment(DiaryComment diaryComment) { @@ -95,5 +101,11 @@ public void addDiaryLike(DiaryLike diaryLike) { diaryLikes.add(diaryLike); } + public void addMissionPostComment(MissionPostComment missionPostComment) { + missionPostComments.add(missionPostComment); + } + public void addMissionPostLike(MissionPostLike missionPostLike) { + missionPostLikes.add(missionPostLike); + } } \ No newline at end of file diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/controller/TestController.java b/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/controller/TestController.java deleted file mode 100644 index 371c9a7b..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/controller/TestController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.vegetable.controller; - -public class TestController { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/dto/TestDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/dto/TestDto.java deleted file mode 100644 index a395bb4f..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/dto/TestDto.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.vegetable.dto; - -public class TestDto { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/entity/TestEntitiy.java b/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/entity/TestEntitiy.java deleted file mode 100644 index f834a664..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/entity/TestEntitiy.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.vegetable.entity; - -public class TestEntitiy { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/repository/TestRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/repository/TestRepository.java deleted file mode 100644 index bc0ae932..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/repository/TestRepository.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.vegetable.repository; - -public class TestRepository { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/service/TestService.java b/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/service/TestService.java deleted file mode 100644 index a14b87a6..00000000 --- a/src/main/java/com/modernfarmer/farmusspring/domain/vegetable/service/TestService.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.modernfarmer.farmusspring.domain.vegetable.service; - -public class TestService { -} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggie/controller/TestController.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/controller/TestController.java new file mode 100644 index 00000000..7b2c9133 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/controller/TestController.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.veggie.controller; + +public class TestController { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggie/dto/TestDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/dto/TestDto.java new file mode 100644 index 00000000..658ec0cd --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/dto/TestDto.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.veggie.dto; + +public class TestDto { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggie/entity/TestEntitiy.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/entity/TestEntitiy.java new file mode 100644 index 00000000..3679d2c7 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/entity/TestEntitiy.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.veggie.entity; + +public class TestEntitiy { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggie/repository/TestRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/repository/TestRepository.java new file mode 100644 index 00000000..55f7319a --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/repository/TestRepository.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.veggie.repository; + +public class TestRepository { +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggie/service/TestService.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/service/TestService.java new file mode 100644 index 00000000..b2f59167 --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggie/service/TestService.java @@ -0,0 +1,4 @@ +package com.modernfarmer.farmusspring.domain.veggie.service; + +public class TestService { +}