From 6645f65eb5e5f1f48b295642e5ad0d98f51b2398 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:23:05 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat=20:=20securityConfig=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/Journey/Together/global/config/SecurityConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/Journey/Together/global/config/SecurityConfig.java b/src/main/java/Journey/Together/global/config/SecurityConfig.java index 152a2f6..0057cd5 100644 --- a/src/main/java/Journey/Together/global/config/SecurityConfig.java +++ b/src/main/java/Journey/Together/global/config/SecurityConfig.java @@ -64,6 +64,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .requestMatchers("/v1/place/main").permitAll() .requestMatchers("v1/place/review/{placeReviewId}").permitAll() .requestMatchers("/v1/plan/guest/**").permitAll() + .requestMatchers("/v1/plan/open").permitAll() + .requestMatchers("/v1/plan/search").permitAll() .requestMatchers("/v1/place/search").permitAll() // 메인 페이지, 공고 페이지 등에 한해 인증 정보 없이 접근 가능 (추후 추가) // 이외의 모든 요청은 인증 정보 필요 From 16d31bb27bc8178f48ada432d51cf1237d2073c6 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:42:55 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix=20:=20isPublic=20false=EB=A1=9C=20?= =?UTF-8?q?=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dairy/dto/PlanDetailRes.java | 13 ++++++++++++- .../domain/dairy/service/PlanService.java | 18 ++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java b/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java index 36fe30e..7f46b59 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java +++ b/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java @@ -4,10 +4,16 @@ import Journey.Together.domain.member.entity.Member; import lombok.Builder; +import java.time.LocalDate; import java.util.List; @Builder public record PlanDetailRes( + String title, + LocalDate startDate, + LocalDate endDate, + String remainDate, + Boolean isPublic, List imageUrls, List dailyList, Boolean isWriter, @@ -15,8 +21,13 @@ public record PlanDetailRes( String writerNickname ) { public static PlanDetailRes of(List imageUrls, - List dailyList, Boolean isWriter, Plan plan){ + List dailyList, Boolean isWriter, Plan plan,String remainDate){ return PlanDetailRes.builder() + .title(plan.getTitle()) + .startDate(plan.getStartDate()) + .endDate(plan.getEndDate()) + .remainDate(remainDate) + .isPublic(plan.getIsPublic()) .imageUrls(imageUrls) .dailyList(dailyList) .isWriter(isWriter) diff --git a/src/main/java/Journey/Together/domain/dairy/service/PlanService.java b/src/main/java/Journey/Together/domain/dairy/service/PlanService.java index 453029a..3cf6c9f 100644 --- a/src/main/java/Journey/Together/domain/dairy/service/PlanService.java +++ b/src/main/java/Journey/Together/domain/dairy/service/PlanService.java @@ -59,6 +59,7 @@ public void savePlan(Member member, PlanReq planReq){ .title(planReq.title()) .startDate(planReq.startDate()) .endDate(planReq.endDate()) + .isPublic(false) .build(); planRepository.save(plan); //날짜별 장소 정보 저장 @@ -129,7 +130,7 @@ public PlanDetailRes findPlanDetail(Member member, Long planId){ if(plan.getEndDate().isAfter(LocalDate.now())){ //imageUrl : 장소 사진 for(Day day : dayList){ - if(day.getPlace().getFirstImg()!=null){ + if(!day.getPlace().getFirstImg().isEmpty()){ imageUrls.add(day.getPlace().getFirstImg()); } } @@ -139,7 +140,7 @@ public PlanDetailRes findPlanDetail(Member member, Long planId){ if(planReviewImageList == null){ //imageUrl : 장소사진 for(Day day : dayList){ - if(day.getPlace().getFirstImg()!=null){ + if(!day.getPlace().getFirstImg().isEmpty()){ imageUrls.add(day.getPlace().getFirstImg()); } } @@ -164,9 +165,18 @@ public PlanDetailRes findPlanDetail(Member member, Long planId){ }else { isWriter = plan.getMember().getMemberId().equals(member.getMemberId()); } + + String remainDate = null; + if ((LocalDate.now().isEqual(plan.getStartDate()) || LocalDate.now().isAfter(plan.getStartDate())) && (LocalDate.now().isEqual(plan.getEndDate()) || LocalDate.now().isBefore(plan.getEndDate()))){ + remainDate = "D-Day"; + }else if (LocalDate.now().isBefore(plan.getStartDate())){ + Period period = Period.between(LocalDate.now(),plan.getStartDate()); + remainDate = "D-"+ period.getDays(); + } + //PlanDetailRes - List imageUrls, List dailyList, Boolean isWriter //Response - return PlanDetailRes.of(imageUrls,dailyLists,isWriter,plan); + return PlanDetailRes.of(imageUrls,dailyLists,isWriter,plan,remainDate); } @Transactional @@ -373,7 +383,7 @@ public String getPlanImageUrl(Member member,Plan plan){ public String getPlaceFirstImage(Member member,Plan plan){ List dayList = dayRepository.findByMemberAndDateAndPlanOrderByCreatedAtDesc(member,plan.getStartDate(),plan); String placeImageUrl = dayList.get(0).getPlace().getFirstImg(); - if(placeImageUrl==null){ + if(!placeImageUrl.isEmpty()){ return null; } return dayList.get(0).getPlace().getFirstImg(); From d904e2686f25e508ac41ef72c7c4367a6d6bf727 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:58:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix=20:=20plan=EC=9D=98=20member=EB=A1=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Together/domain/bookbark/service/BookmarkService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java b/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java index 2128f45..9b951e9 100644 --- a/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java +++ b/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java @@ -115,7 +115,7 @@ public List getPlanBookmarks(Member member) { List planBookmarkList = planBookmarkRepository.findAllByMemberOrderByCreatedAtDesc(member); planBookmarkList.forEach( planBookmark -> { - list.add(PlanBookmarkRes.of(planBookmark.getPlan(),s3Client.getUrl()+planBookmark.getMember().getProfileUuid()+"/profile",getPlanImageUrl(member, planBookmark.getPlan()))); + list.add(PlanBookmarkRes.of(planBookmark.getPlan(),s3Client.getUrl()+planBookmark.getPlan().getMember().getProfileUuid()+"/profile",getPlanImageUrl(member, planBookmark.getPlan()))); }); return list; From 1f4e908ec7cf74d5f3d843cd40aee3b8bc6ca879 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Wed, 12 Jun 2024 11:51:30 +0900 Subject: [PATCH 4/5] fix : package name diary->plan --- .../domain/bookbark/entity/PlanBookmark.java | 3 +-- .../bookbark/entity/PlanBookmarkRes.java | 4 +--- .../repository/PlanBookmarkRepository.java | 4 +--- .../bookbark/service/BookmarkService.java | 11 ++++------ .../domain/dairy/dto/PlanReviewReq.java | 13 ----------- .../member/controller/MemberController.java | 4 ---- .../controller/PlanController.java | 8 +++---- .../domain/{dairy => plan}/dto/DailyList.java | 2 +- .../{dairy => plan}/dto/DailyPlace.java | 2 +- .../{dairy => plan}/dto/DailyPlaceInfo.java | 2 +- .../domain/{dairy => plan}/dto/MyPlanRes.java | 4 ++-- .../{dairy => plan}/dto/OpenPlanPageRes.java | 2 +- .../{dairy => plan}/dto/OpenPlanRes.java | 4 ++-- .../domain/{dairy => plan}/dto/PlaceInfo.java | 6 +---- .../{dairy => plan}/dto/PlaceInfoPageRes.java | 2 +- .../{dairy => plan}/dto/PlanDetailRes.java | 5 ++--- .../{dairy => plan}/dto/PlanPageRes.java | 4 +--- .../domain/{dairy => plan}/dto/PlanReq.java | 2 +- .../domain/{dairy => plan}/dto/PlanRes.java | 4 ++-- .../domain/plan/dto/PlanReviewReq.java | 8 +++++++ .../{dairy => plan}/dto/PlanReviewRes.java | 3 +-- .../domain/{dairy => plan}/entity/Day.java | 2 +- .../domain/{dairy => plan}/entity/Plan.java | 2 +- .../{dairy => plan}/entity/PlanReview.java | 2 +- .../entity/PlanReviewImage.java | 3 +-- .../repository/DayRepository.java | 6 ++--- .../repository/PlanRepository.java | 5 ++--- .../repository/PlanReviewImageRepository.java | 6 ++--- .../repository/PlanReviewRepository.java | 6 ++--- .../{dairy => plan}/service/PlanService.java | 22 +++++++++---------- 30 files changed, 60 insertions(+), 91 deletions(-) delete mode 100644 src/main/java/Journey/Together/domain/dairy/dto/PlanReviewReq.java rename src/main/java/Journey/Together/domain/{dairy => plan}/controller/PlanController.java (95%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/DailyList.java (91%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/DailyPlace.java (75%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/DailyPlaceInfo.java (95%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/MyPlanRes.java (89%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/OpenPlanPageRes.java (94%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/OpenPlanRes.java (90%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlaceInfo.java (77%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlaceInfoPageRes.java (94%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlanDetailRes.java (88%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlanPageRes.java (89%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlanReq.java (83%) rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlanRes.java (90%) create mode 100644 src/main/java/Journey/Together/domain/plan/dto/PlanReviewReq.java rename src/main/java/Journey/Together/domain/{dairy => plan}/dto/PlanReviewRes.java (88%) rename src/main/java/Journey/Together/domain/{dairy => plan}/entity/Day.java (96%) rename src/main/java/Journey/Together/domain/{dairy => plan}/entity/Plan.java (96%) rename src/main/java/Journey/Together/domain/{dairy => plan}/entity/PlanReview.java (96%) rename src/main/java/Journey/Together/domain/{dairy => plan}/entity/PlanReviewImage.java (89%) rename src/main/java/Journey/Together/domain/{dairy => plan}/repository/DayRepository.java (76%) rename src/main/java/Journey/Together/domain/{dairy => plan}/repository/PlanRepository.java (90%) rename src/main/java/Journey/Together/domain/{dairy => plan}/repository/PlanReviewImageRepository.java (67%) rename src/main/java/Journey/Together/domain/{dairy => plan}/repository/PlanReviewRepository.java (70%) rename src/main/java/Journey/Together/domain/{dairy => plan}/service/PlanService.java (96%) diff --git a/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmark.java b/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmark.java index dc20975..cb75d6f 100644 --- a/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmark.java +++ b/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmark.java @@ -1,8 +1,7 @@ package Journey.Together.domain.bookbark.entity; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import Journey.Together.domain.member.entity.Member; -import Journey.Together.domain.place.entity.Place; import Journey.Together.global.common.BaseTimeEntity; import jakarta.persistence.*; import lombok.*; diff --git a/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmarkRes.java b/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmarkRes.java index 160ac64..e91d780 100644 --- a/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmarkRes.java +++ b/src/main/java/Journey/Together/domain/bookbark/entity/PlanBookmarkRes.java @@ -1,8 +1,6 @@ package Journey.Together.domain.bookbark.entity; -import Journey.Together.domain.bookbark.dto.PlaceBookmarkRes; -import Journey.Together.domain.dairy.entity.Plan; -import Journey.Together.global.util.S3Client; +import Journey.Together.domain.plan.entity.Plan; import jakarta.annotation.Nullable; public record PlanBookmarkRes( diff --git a/src/main/java/Journey/Together/domain/bookbark/repository/PlanBookmarkRepository.java b/src/main/java/Journey/Together/domain/bookbark/repository/PlanBookmarkRepository.java index 683c8a4..afb96d7 100644 --- a/src/main/java/Journey/Together/domain/bookbark/repository/PlanBookmarkRepository.java +++ b/src/main/java/Journey/Together/domain/bookbark/repository/PlanBookmarkRepository.java @@ -1,11 +1,9 @@ package Journey.Together.domain.bookbark.repository; -import Journey.Together.domain.bookbark.entity.PlaceBookmark; import Journey.Together.domain.bookbark.entity.PlanBookmark; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import Journey.Together.domain.member.entity.Member; -import Journey.Together.domain.place.entity.Place; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java b/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java index 9b951e9..d4246e9 100644 --- a/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java +++ b/src/main/java/Journey/Together/domain/bookbark/service/BookmarkService.java @@ -6,15 +6,12 @@ import Journey.Together.domain.bookbark.entity.PlanBookmarkRes; import Journey.Together.domain.bookbark.repository.PlaceBookmarkRepository; import Journey.Together.domain.bookbark.repository.PlanBookmarkRepository; -import java.util.Optional; -import Journey.Together.domain.dairy.entity.Day; -import Journey.Together.domain.dairy.entity.Plan; -import Journey.Together.domain.dairy.repository.DayRepository; -import Journey.Together.domain.dairy.repository.PlanRepository; -import Journey.Together.domain.dairy.service.PlanService; +import Journey.Together.domain.plan.entity.Day; +import Journey.Together.domain.plan.entity.Plan; +import Journey.Together.domain.plan.repository.DayRepository; +import Journey.Together.domain.plan.repository.PlanRepository; import Journey.Together.domain.member.entity.Member; import Journey.Together.domain.place.dto.response.PlaceBookmarkDto; -import Journey.Together.domain.place.entity.DisabilityPlaceCategory; import Journey.Together.domain.place.entity.Place; import Journey.Together.domain.place.repository.DisabilityPlaceCategoryRepository; import Journey.Together.domain.place.repository.PlaceRepository; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanReviewReq.java b/src/main/java/Journey/Together/domain/dairy/dto/PlanReviewReq.java deleted file mode 100644 index 635f6b7..0000000 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanReviewReq.java +++ /dev/null @@ -1,13 +0,0 @@ -package Journey.Together.domain.dairy.dto; - -import org.springframework.web.multipart.MultipartFile; - -import javax.swing.text.StyledEditorKit; -import java.util.List; - -public record PlanReviewReq( - float grade, - String content, - Boolean isPublic -) { -} diff --git a/src/main/java/Journey/Together/domain/member/controller/MemberController.java b/src/main/java/Journey/Together/domain/member/controller/MemberController.java index df336fe..f299f78 100644 --- a/src/main/java/Journey/Together/domain/member/controller/MemberController.java +++ b/src/main/java/Journey/Together/domain/member/controller/MemberController.java @@ -1,6 +1,5 @@ package Journey.Together.domain.member.controller; -import Journey.Together.domain.dairy.dto.PlanReviewReq; import Journey.Together.domain.member.dto.InterestDto; import Journey.Together.domain.member.dto.MemberReq; import Journey.Together.domain.member.dto.MemberRes; @@ -9,14 +8,11 @@ import Journey.Together.global.exception.Success; import Journey.Together.global.security.PrincipalDetails; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.constraints.Null; import lombok.RequiredArgsConstructor; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.util.List; - @RestController @RequiredArgsConstructor @RequestMapping("/v1/member") diff --git a/src/main/java/Journey/Together/domain/dairy/controller/PlanController.java b/src/main/java/Journey/Together/domain/plan/controller/PlanController.java similarity index 95% rename from src/main/java/Journey/Together/domain/dairy/controller/PlanController.java rename to src/main/java/Journey/Together/domain/plan/controller/PlanController.java index a26509f..f23e405 100644 --- a/src/main/java/Journey/Together/domain/dairy/controller/PlanController.java +++ b/src/main/java/Journey/Together/domain/plan/controller/PlanController.java @@ -1,13 +1,11 @@ -package Journey.Together.domain.dairy.controller; +package Journey.Together.domain.plan.controller; -import Journey.Together.domain.dairy.dto.*; -import Journey.Together.domain.dairy.service.PlanService; -import Journey.Together.domain.member.entity.Member; +import Journey.Together.domain.plan.dto.*; +import Journey.Together.domain.plan.service.PlanService; import Journey.Together.global.common.ApiResponse; import Journey.Together.global.exception.Success; import Journey.Together.global.security.PrincipalDetails; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.constraints.Null; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/DailyList.java b/src/main/java/Journey/Together/domain/plan/dto/DailyList.java similarity index 91% rename from src/main/java/Journey/Together/domain/dairy/dto/DailyList.java rename to src/main/java/Journey/Together/domain/plan/dto/DailyList.java index 18ab5d7..466d681 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/DailyList.java +++ b/src/main/java/Journey/Together/domain/plan/dto/DailyList.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/DailyPlace.java b/src/main/java/Journey/Together/domain/plan/dto/DailyPlace.java similarity index 75% rename from src/main/java/Journey/Together/domain/dairy/dto/DailyPlace.java rename to src/main/java/Journey/Together/domain/plan/dto/DailyPlace.java index 2edc046..492d9c2 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/DailyPlace.java +++ b/src/main/java/Journey/Together/domain/plan/dto/DailyPlace.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import java.time.LocalDate; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/DailyPlaceInfo.java b/src/main/java/Journey/Together/domain/plan/dto/DailyPlaceInfo.java similarity index 95% rename from src/main/java/Journey/Together/domain/dairy/dto/DailyPlaceInfo.java rename to src/main/java/Journey/Together/domain/plan/dto/DailyPlaceInfo.java index da49b90..109ee49 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/DailyPlaceInfo.java +++ b/src/main/java/Journey/Together/domain/plan/dto/DailyPlaceInfo.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import Journey.Together.domain.place.entity.Place; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/MyPlanRes.java b/src/main/java/Journey/Together/domain/plan/dto/MyPlanRes.java similarity index 89% rename from src/main/java/Journey/Together/domain/dairy/dto/MyPlanRes.java rename to src/main/java/Journey/Together/domain/plan/dto/MyPlanRes.java index a014a9e..2ab4f2c 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/MyPlanRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/MyPlanRes.java @@ -1,6 +1,6 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import jakarta.validation.constraints.Null; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/OpenPlanPageRes.java b/src/main/java/Journey/Together/domain/plan/dto/OpenPlanPageRes.java similarity index 94% rename from src/main/java/Journey/Together/domain/dairy/dto/OpenPlanPageRes.java rename to src/main/java/Journey/Together/domain/plan/dto/OpenPlanPageRes.java index 565e6e8..5d4742f 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/OpenPlanPageRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/OpenPlanPageRes.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/OpenPlanRes.java b/src/main/java/Journey/Together/domain/plan/dto/OpenPlanRes.java similarity index 90% rename from src/main/java/Journey/Together/domain/dairy/dto/OpenPlanRes.java rename to src/main/java/Journey/Together/domain/plan/dto/OpenPlanRes.java index 7b53b70..39eb607 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/OpenPlanRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/OpenPlanRes.java @@ -1,6 +1,6 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import lombok.Builder; import java.time.Period; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlaceInfo.java b/src/main/java/Journey/Together/domain/plan/dto/PlaceInfo.java similarity index 77% rename from src/main/java/Journey/Together/domain/dairy/dto/PlaceInfo.java rename to src/main/java/Journey/Together/domain/plan/dto/PlaceInfo.java index 9958ec8..a8d55e7 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlaceInfo.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlaceInfo.java @@ -1,12 +1,8 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.place.dto.response.PlaceDetailRes; -import Journey.Together.domain.place.dto.response.PlaceReviewDto; import Journey.Together.domain.place.entity.Place; import lombok.Builder; -import java.util.List; - @Builder public record PlaceInfo( Long placeId, diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlaceInfoPageRes.java b/src/main/java/Journey/Together/domain/plan/dto/PlaceInfoPageRes.java similarity index 94% rename from src/main/java/Journey/Together/domain/dairy/dto/PlaceInfoPageRes.java rename to src/main/java/Journey/Together/domain/plan/dto/PlaceInfoPageRes.java index bfc107a..d5aef21 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlaceInfoPageRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlaceInfoPageRes.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java b/src/main/java/Journey/Together/domain/plan/dto/PlanDetailRes.java similarity index 88% rename from src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java rename to src/main/java/Journey/Together/domain/plan/dto/PlanDetailRes.java index 7f46b59..3a94cd5 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanDetailRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanDetailRes.java @@ -1,7 +1,6 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.dairy.entity.Plan; -import Journey.Together.domain.member.entity.Member; +import Journey.Together.domain.plan.entity.Plan; import lombok.Builder; import java.time.LocalDate; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanPageRes.java b/src/main/java/Journey/Together/domain/plan/dto/PlanPageRes.java similarity index 89% rename from src/main/java/Journey/Together/domain/dairy/dto/PlanPageRes.java rename to src/main/java/Journey/Together/domain/plan/dto/PlanPageRes.java index ea9a4a0..9ac5086 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanPageRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanPageRes.java @@ -1,8 +1,6 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import lombok.Builder; -import lombok.Getter; -import lombok.Setter; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanReq.java b/src/main/java/Journey/Together/domain/plan/dto/PlanReq.java similarity index 83% rename from src/main/java/Journey/Together/domain/dairy/dto/PlanReq.java rename to src/main/java/Journey/Together/domain/plan/dto/PlanReq.java index 345a9c5..7e55263 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanReq.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanReq.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; import java.time.LocalDate; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanRes.java b/src/main/java/Journey/Together/domain/plan/dto/PlanRes.java similarity index 90% rename from src/main/java/Journey/Together/domain/dairy/dto/PlanRes.java rename to src/main/java/Journey/Together/domain/plan/dto/PlanRes.java index 11dd73d..1c7078d 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanRes.java @@ -1,6 +1,6 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import com.fasterxml.jackson.annotation.JsonInclude; import jakarta.validation.constraints.Null; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/plan/dto/PlanReviewReq.java b/src/main/java/Journey/Together/domain/plan/dto/PlanReviewReq.java new file mode 100644 index 0000000..c65f004 --- /dev/null +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanReviewReq.java @@ -0,0 +1,8 @@ +package Journey.Together.domain.plan.dto; + +public record PlanReviewReq( + float grade, + String content, + Boolean isPublic +) { +} diff --git a/src/main/java/Journey/Together/domain/dairy/dto/PlanReviewRes.java b/src/main/java/Journey/Together/domain/plan/dto/PlanReviewRes.java similarity index 88% rename from src/main/java/Journey/Together/domain/dairy/dto/PlanReviewRes.java rename to src/main/java/Journey/Together/domain/plan/dto/PlanReviewRes.java index c55a27d..a8d36ed 100644 --- a/src/main/java/Journey/Together/domain/dairy/dto/PlanReviewRes.java +++ b/src/main/java/Journey/Together/domain/plan/dto/PlanReviewRes.java @@ -1,6 +1,5 @@ -package Journey.Together.domain.dairy.dto; +package Journey.Together.domain.plan.dto; -import Journey.Together.domain.dairy.entity.PlanReview; import jakarta.validation.constraints.Null; import lombok.Builder; diff --git a/src/main/java/Journey/Together/domain/dairy/entity/Day.java b/src/main/java/Journey/Together/domain/plan/entity/Day.java similarity index 96% rename from src/main/java/Journey/Together/domain/dairy/entity/Day.java rename to src/main/java/Journey/Together/domain/plan/entity/Day.java index 47d2592..57b1386 100644 --- a/src/main/java/Journey/Together/domain/dairy/entity/Day.java +++ b/src/main/java/Journey/Together/domain/plan/entity/Day.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.entity; +package Journey.Together.domain.plan.entity; import Journey.Together.domain.member.entity.Member; import Journey.Together.domain.place.entity.Place; diff --git a/src/main/java/Journey/Together/domain/dairy/entity/Plan.java b/src/main/java/Journey/Together/domain/plan/entity/Plan.java similarity index 96% rename from src/main/java/Journey/Together/domain/dairy/entity/Plan.java rename to src/main/java/Journey/Together/domain/plan/entity/Plan.java index c2ff9b2..1afe5f1 100644 --- a/src/main/java/Journey/Together/domain/dairy/entity/Plan.java +++ b/src/main/java/Journey/Together/domain/plan/entity/Plan.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.entity; +package Journey.Together.domain.plan.entity; import Journey.Together.domain.member.entity.Member; import Journey.Together.global.common.BaseTimeEntity; diff --git a/src/main/java/Journey/Together/domain/dairy/entity/PlanReview.java b/src/main/java/Journey/Together/domain/plan/entity/PlanReview.java similarity index 96% rename from src/main/java/Journey/Together/domain/dairy/entity/PlanReview.java rename to src/main/java/Journey/Together/domain/plan/entity/PlanReview.java index da898b5..091d045 100644 --- a/src/main/java/Journey/Together/domain/dairy/entity/PlanReview.java +++ b/src/main/java/Journey/Together/domain/plan/entity/PlanReview.java @@ -1,4 +1,4 @@ -package Journey.Together.domain.dairy.entity; +package Journey.Together.domain.plan.entity; import Journey.Together.global.common.BaseTimeEntity; import jakarta.persistence.*; diff --git a/src/main/java/Journey/Together/domain/dairy/entity/PlanReviewImage.java b/src/main/java/Journey/Together/domain/plan/entity/PlanReviewImage.java similarity index 89% rename from src/main/java/Journey/Together/domain/dairy/entity/PlanReviewImage.java rename to src/main/java/Journey/Together/domain/plan/entity/PlanReviewImage.java index 7398f61..43f015b 100644 --- a/src/main/java/Journey/Together/domain/dairy/entity/PlanReviewImage.java +++ b/src/main/java/Journey/Together/domain/plan/entity/PlanReviewImage.java @@ -1,7 +1,6 @@ -package Journey.Together.domain.dairy.entity; +package Journey.Together.domain.plan.entity; import Journey.Together.global.common.BaseTimeEntity; -import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*; import lombok.*; diff --git a/src/main/java/Journey/Together/domain/dairy/repository/DayRepository.java b/src/main/java/Journey/Together/domain/plan/repository/DayRepository.java similarity index 76% rename from src/main/java/Journey/Together/domain/dairy/repository/DayRepository.java rename to src/main/java/Journey/Together/domain/plan/repository/DayRepository.java index 71ded4c..7d196f2 100644 --- a/src/main/java/Journey/Together/domain/dairy/repository/DayRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/DayRepository.java @@ -1,7 +1,7 @@ -package Journey.Together.domain.dairy.repository; +package Journey.Together.domain.plan.repository; -import Journey.Together.domain.dairy.entity.Day; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Day; +import Journey.Together.domain.plan.entity.Plan; import Journey.Together.domain.member.entity.Member; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/Journey/Together/domain/dairy/repository/PlanRepository.java b/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java similarity index 90% rename from src/main/java/Journey/Together/domain/dairy/repository/PlanRepository.java rename to src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java index f8e2239..0379de7 100644 --- a/src/main/java/Journey/Together/domain/dairy/repository/PlanRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java @@ -1,11 +1,10 @@ -package Journey.Together.domain.dairy.repository; +package Journey.Together.domain.plan.repository; -import Journey.Together.domain.dairy.entity.Plan; +import Journey.Together.domain.plan.entity.Plan; import Journey.Together.domain.member.entity.Member; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; -import java.util.Optional; import java.time.LocalDate; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/dairy/repository/PlanReviewImageRepository.java b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewImageRepository.java similarity index 67% rename from src/main/java/Journey/Together/domain/dairy/repository/PlanReviewImageRepository.java rename to src/main/java/Journey/Together/domain/plan/repository/PlanReviewImageRepository.java index 5a9484f..302a5fe 100644 --- a/src/main/java/Journey/Together/domain/dairy/repository/PlanReviewImageRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewImageRepository.java @@ -1,7 +1,7 @@ -package Journey.Together.domain.dairy.repository; +package Journey.Together.domain.plan.repository; -import Journey.Together.domain.dairy.entity.PlanReview; -import Journey.Together.domain.dairy.entity.PlanReviewImage; +import Journey.Together.domain.plan.entity.PlanReview; +import Journey.Together.domain.plan.entity.PlanReviewImage; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; diff --git a/src/main/java/Journey/Together/domain/dairy/repository/PlanReviewRepository.java b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java similarity index 70% rename from src/main/java/Journey/Together/domain/dairy/repository/PlanReviewRepository.java rename to src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java index 6d29fe1..d2ff707 100644 --- a/src/main/java/Journey/Together/domain/dairy/repository/PlanReviewRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java @@ -1,7 +1,7 @@ -package Journey.Together.domain.dairy.repository; +package Journey.Together.domain.plan.repository; -import Journey.Together.domain.dairy.entity.Plan; -import Journey.Together.domain.dairy.entity.PlanReview; +import Journey.Together.domain.plan.entity.Plan; +import Journey.Together.domain.plan.entity.PlanReview; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/Journey/Together/domain/dairy/service/PlanService.java b/src/main/java/Journey/Together/domain/plan/service/PlanService.java similarity index 96% rename from src/main/java/Journey/Together/domain/dairy/service/PlanService.java rename to src/main/java/Journey/Together/domain/plan/service/PlanService.java index 3cf6c9f..0363c42 100644 --- a/src/main/java/Journey/Together/domain/dairy/service/PlanService.java +++ b/src/main/java/Journey/Together/domain/plan/service/PlanService.java @@ -1,17 +1,16 @@ -package Journey.Together.domain.dairy.service; +package Journey.Together.domain.plan.service; -import Journey.Together.domain.dairy.dto.*; -import Journey.Together.domain.dairy.entity.Day; -import Journey.Together.domain.dairy.entity.Plan; -import Journey.Together.domain.dairy.entity.PlanReview; -import Journey.Together.domain.dairy.entity.PlanReviewImage; -import Journey.Together.domain.dairy.repository.DayRepository; -import Journey.Together.domain.dairy.repository.PlanRepository; -import Journey.Together.domain.dairy.repository.PlanReviewImageRepository; -import Journey.Together.domain.dairy.repository.PlanReviewRepository; +import Journey.Together.domain.plan.dto.*; +import Journey.Together.domain.plan.entity.Day; +import Journey.Together.domain.plan.entity.Plan; +import Journey.Together.domain.plan.entity.PlanReview; +import Journey.Together.domain.plan.entity.PlanReviewImage; +import Journey.Together.domain.plan.repository.DayRepository; +import Journey.Together.domain.plan.repository.PlanRepository; +import Journey.Together.domain.plan.repository.PlanReviewImageRepository; +import Journey.Together.domain.plan.repository.PlanReviewRepository; import Journey.Together.domain.member.entity.Member; import Journey.Together.domain.member.repository.MemberRepository; -import Journey.Together.domain.place.entity.DisabilityPlaceCategory; import Journey.Together.domain.place.entity.Place; import Journey.Together.domain.place.repository.DisabilityPlaceCategoryRepository; import Journey.Together.domain.place.repository.PlaceRepository; @@ -23,7 +22,6 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; -import org.springframework.security.core.parameters.P; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; From a257075ec97b45e45731a5b71a198e11ac800f95 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Wed, 12 Jun 2024 12:39:41 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix=20:=20my=EC=97=90=EC=84=9C=20startDate?= =?UTF-8?q?=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20=EA=B0=80=EA=B9=8C?= =?UTF-8?q?=EC=9A=B4=203=EA=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/repository/PlanRepository.java | 1 - .../domain/plan/service/PlanService.java | 24 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java b/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java index 0379de7..e7b8da6 100644 --- a/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/PlanRepository.java @@ -11,7 +11,6 @@ public interface PlanRepository extends JpaRepository { Plan findPlanByPlanIdAndDeletedAtIsNull(Long planId); - Plan findPlanByMemberAndPlanIdAndDeletedAtIsNull(Member member,Long planId); List findAllByMemberAndDeletedAtIsNull(Member member); Plan findPlanByMemberAndPlanIdAndEndDateIsBeforeAndDeletedAtIsNull(Member member, Long planId, LocalDate today); diff --git a/src/main/java/Journey/Together/domain/plan/service/PlanService.java b/src/main/java/Journey/Together/domain/plan/service/PlanService.java index 0363c42..aab2fc1 100644 --- a/src/main/java/Journey/Together/domain/plan/service/PlanService.java +++ b/src/main/java/Journey/Together/domain/plan/service/PlanService.java @@ -28,10 +28,8 @@ import java.time.LocalDate; import java.time.Period; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.UUID; +import java.time.temporal.ChronoUnit; +import java.util.*; import java.util.stream.Collectors; @Service @@ -279,8 +277,12 @@ public List findMyPlans(Member member) { return null; } //Business + List top3list = list.stream() + .sorted(Comparator.comparingLong(plan -> Math.abs(ChronoUnit.DAYS.between(LocalDate.now(), plan.getStartDate())))) + .limit(3) + .toList(); List myPlanResList = new ArrayList<>(); - for(Plan plan : list){ + for(Plan plan : top3list){ String image = getPlanImageUrl(member,plan); if (LocalDate.now().isAfter(plan.getEndDate())){ Boolean hasReview = planReviewRepository.existsAllByPlan(plan); @@ -380,11 +382,15 @@ public String getPlanImageUrl(Member member,Plan plan){ public String getPlaceFirstImage(Member member,Plan plan){ List dayList = dayRepository.findByMemberAndDateAndPlanOrderByCreatedAtDesc(member,plan.getStartDate(),plan); - String placeImageUrl = dayList.get(0).getPlace().getFirstImg(); - if(!placeImageUrl.isEmpty()){ - return null; + if(!dayList.isEmpty()){ + System.out.println(dayList); + String placeImageUrl = dayList.get(0).getPlace().getFirstImg(); + if(!placeImageUrl.isEmpty()){ + return null; + } + return dayList.get(0).getPlace().getFirstImg(); } - return dayList.get(0).getPlace().getFirstImg(); + return null; } public List getReviewImageList(List planReviewImageList){