From 1a8a03f3366dc7e8035de2092e765673877a86bd Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 21:44:23 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[CHORE]=20=EC=BC=80=EC=9D=B4=ED=81=AC=20?= =?UTF-8?q?=EA=B0=80=EA=B2=A9=20=EB=AF=B8=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java index b297cf61..a19351d2 100644 --- a/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java @@ -7,14 +7,13 @@ import lombok.Builder; @Builder(access = PRIVATE) -public record CakeResponseDTO(Long cakeId, String name, String imageUrl, int price) { +public record CakeResponseDTO(Long cakeId, String name, String imageUrl) { public static CakeResponseDTO from(Cake cake) { return CakeResponseDTO.builder() .cakeId(cake.getId()) .name(cake.getName()) .imageUrl(cake.getImageUrl()) - .price(cake.getPrice()) .build(); } From ea9f8c133fbb33910aa666987a1552c713e1389e Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 21:44:40 +0900 Subject: [PATCH 02/11] =?UTF-8?q?[CHORE]=20=EC=84=A0=EB=AC=BC=20=EA=B0=80?= =?UTF-8?q?=EA=B2=A9=20=EB=B0=8F=20=ED=8D=BC=EC=84=BC=ED=8A=B8=20=EB=AF=B8?= =?UTF-8?q?=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopterm/makeawish/dto/wish/UserWishResponseDTO.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishResponseDTO.java index e6e2006b..9403a3ce 100644 --- a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishResponseDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishResponseDTO.java @@ -1,7 +1,5 @@ package com.sopterm.makeawish.dto.wish; -import static com.sopterm.makeawish.common.Util.*; - import com.sopterm.makeawish.domain.wish.Wish; import lombok.Builder; @@ -10,9 +8,7 @@ public record UserWishResponseDTO( String title, String startAt, - String endAt, - int price, - int percent + String endAt ) { public static UserWishResponseDTO of(Wish wish) { @@ -20,8 +16,7 @@ public static UserWishResponseDTO of(Wish wish) { .title(wish.getTitle()) .startAt(wish.getStartAt().toString()) .endAt(wish.getEndAt().toString()) - .price(getPriceAppliedFee(wish.getTotalPrice())) - .percent(getPricePercent(wish.getTotalPrice(), wish.getPresentPrice())) + .build(); } } From 6add2fc0d685b3d9871d50f1327f56541f0336b6 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 21:45:37 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[CHORE]=20=EC=BC=80=EC=9D=B4=ED=81=AC=20?= =?UTF-8?q?=EA=B0=80=EA=B2=A9=20=EB=B0=8F=20=ED=8D=BC=EC=84=BC=ED=8A=B8=20?= =?UTF-8?q?=EB=AF=B8=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java index a19351d2..97c91ea3 100644 --- a/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/cake/CakeResponseDTO.java @@ -21,8 +21,6 @@ public Cake toEntity(){ return Cake.builder() .id(cakeId) .name(name) - .imageUrl(imageUrl) - .price(price) .build(); } } From 54c6c64b8bea368263a56d82498946c6f7ce20c3 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 21:48:57 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[FEAT]=20=EC=84=A0=EB=AC=BC=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopterm/makeawish/controller/PublicController.java | 7 +++++++ .../java/com/sopterm/makeawish/service/CakeService.java | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/sopterm/makeawish/controller/PublicController.java b/src/main/java/com/sopterm/makeawish/controller/PublicController.java index 37d4baf7..396b8e01 100644 --- a/src/main/java/com/sopterm/makeawish/controller/PublicController.java +++ b/src/main/java/com/sopterm/makeawish/controller/PublicController.java @@ -40,6 +40,13 @@ public ResponseEntity getAllCakes() { return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_ALL_CAKE.getMessage(), response)); } + @Operation(summary = "선물 리스트 조회") + @GetMapping("/giftMenu") + public ResponseEntity getAllGiftMenu(){ + val response = cakeService.getAllGiftMenu(); + return ResponseEntity.ok(ApiResponse.success("선물 리스트 조회", response)); + } + @Operation(summary = "소원 링크 조회") @GetMapping("/wishes/{wishId}") public ResponseEntity findWish(@PathVariable Long wishId) throws AccessDeniedException { diff --git a/src/main/java/com/sopterm/makeawish/service/CakeService.java b/src/main/java/com/sopterm/makeawish/service/CakeService.java index 0f2d4c55..3abf5b47 100644 --- a/src/main/java/com/sopterm/makeawish/service/CakeService.java +++ b/src/main/java/com/sopterm/makeawish/service/CakeService.java @@ -169,4 +169,8 @@ public CakeCreateResponseDTO createPresent(CakeCreateRequest request) { private GiftMenu getGiftMenuInfo(Long giftMenuId){ return giftMenuRepository.findById(giftMenuId).orElseThrow(() -> new EntityNotFoundException(INVALID_GIFT_MENU.getMessage())); } + + public List getAllGiftMenu(){ + return giftMenuRepository.findAll(); + } } From c442c18b37d99e674a32176bd07222a7cdb16542 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 21:56:16 +0900 Subject: [PATCH 05/11] =?UTF-8?q?[FEAT]=20=EC=84=A0=EB=AC=BC=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/message/SuccessMessage.java | 6 +++++- .../makeawish/controller/PublicController.java | 4 ++-- .../dto/giftMenu/GiftMenuResponseDTO.java | 17 +++++++++++++++++ .../sopterm/makeawish/service/CakeService.java | 16 ++++++++-------- 4 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/sopterm/makeawish/dto/giftMenu/GiftMenuResponseDTO.java diff --git a/src/main/java/com/sopterm/makeawish/common/message/SuccessMessage.java b/src/main/java/com/sopterm/makeawish/common/message/SuccessMessage.java index a039ae23..f2a87f02 100644 --- a/src/main/java/com/sopterm/makeawish/common/message/SuccessMessage.java +++ b/src/main/java/com/sopterm/makeawish/common/message/SuccessMessage.java @@ -40,7 +40,11 @@ public enum SuccessMessage { /** present **/ SUCCESS_GET_ALL_PRESENT("선물 전체 조회 성공"), - SUCCESS_GET_PRESENT_MESSAGE("케이크에 대한 편지 조회 성공"); + SUCCESS_GET_PRESENT_MESSAGE("케이크에 대한 편지 조회 성공"), + + /** gift menu **/ + SUCESS_GET_ALL_GIFT_MENU("선물 가능한 목록 전체 조회 성공") + ; private final String message; } diff --git a/src/main/java/com/sopterm/makeawish/controller/PublicController.java b/src/main/java/com/sopterm/makeawish/controller/PublicController.java index 396b8e01..f9c534e7 100644 --- a/src/main/java/com/sopterm/makeawish/controller/PublicController.java +++ b/src/main/java/com/sopterm/makeawish/controller/PublicController.java @@ -40,11 +40,11 @@ public ResponseEntity getAllCakes() { return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_ALL_CAKE.getMessage(), response)); } - @Operation(summary = "선물 리스트 조회") + @Operation(summary = "선물 가능 리스트 조회") @GetMapping("/giftMenu") public ResponseEntity getAllGiftMenu(){ val response = cakeService.getAllGiftMenu(); - return ResponseEntity.ok(ApiResponse.success("선물 리스트 조회", response)); + return ResponseEntity.ok(ApiResponse.success(SUCESS_GET_ALL_GIFT_MENU.getMessage(), response)); } @Operation(summary = "소원 링크 조회") diff --git a/src/main/java/com/sopterm/makeawish/dto/giftMenu/GiftMenuResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/giftMenu/GiftMenuResponseDTO.java new file mode 100644 index 00000000..defd51d1 --- /dev/null +++ b/src/main/java/com/sopterm/makeawish/dto/giftMenu/GiftMenuResponseDTO.java @@ -0,0 +1,17 @@ +package com.sopterm.makeawish.dto.giftMenu; + +import com.sopterm.makeawish.domain.GiftMenu; +import lombok.Builder; + +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) +public record GiftMenuResponseDTO(Long giftMenuId, String name, int price) { + public static GiftMenuResponseDTO from(GiftMenu giftMenu) { + return GiftMenuResponseDTO.builder() + .giftMenuId(giftMenu.getId()) + .name(giftMenu.getName()) + .price(giftMenu.getPrice()) + .build(); + } +} diff --git a/src/main/java/com/sopterm/makeawish/service/CakeService.java b/src/main/java/com/sopterm/makeawish/service/CakeService.java index 3abf5b47..905a5781 100644 --- a/src/main/java/com/sopterm/makeawish/service/CakeService.java +++ b/src/main/java/com/sopterm/makeawish/service/CakeService.java @@ -1,20 +1,20 @@ package com.sopterm.makeawish.service; import com.sopterm.makeawish.common.KakaoPayProperties; -import com.sopterm.makeawish.common.Util; import com.sopterm.makeawish.domain.Cake; import com.sopterm.makeawish.domain.GiftMenu; import com.sopterm.makeawish.domain.Present; import com.sopterm.makeawish.domain.wish.Wish; import com.sopterm.makeawish.dto.cake.*; +import com.sopterm.makeawish.dto.giftMenu.GiftMenuResponseDTO; import com.sopterm.makeawish.dto.present.PresentDTO; import com.sopterm.makeawish.dto.present.PresentResponseDTO; import com.sopterm.makeawish.repository.CakeRepository; import com.sopterm.makeawish.repository.GiftMenuRepository; import com.sopterm.makeawish.repository.PresentRepository; import jakarta.persistence.EntityNotFoundException; -import lombok.*; -import org.springframework.cache.annotation.Cacheable; +import lombok.RequiredArgsConstructor; +import lombok.val; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; @@ -24,9 +24,7 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; -import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; import static com.sopterm.makeawish.common.message.ErrorMessage.*; @@ -166,11 +164,13 @@ public CakeCreateResponseDTO createPresent(CakeCreateRequest request) { return new CakeCreateResponseDTO(cake.getId(), wish.getPresentImageUrl(), wish.getHint(), wish.getInitial(), wish.getWisher().getNickname()); } - private GiftMenu getGiftMenuInfo(Long giftMenuId){ + private GiftMenu getGiftMenuInfo(Long giftMenuId) { return giftMenuRepository.findById(giftMenuId).orElseThrow(() -> new EntityNotFoundException(INVALID_GIFT_MENU.getMessage())); } - public List getAllGiftMenu(){ - return giftMenuRepository.findAll(); + public List getAllGiftMenu() { + return giftMenuRepository.findAll().stream() + .map(GiftMenuResponseDTO::from) + .collect(Collectors.toList()); } } From e65e17df71c59a4d8d78c19d768cd499a121c74e Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:00:51 +0900 Subject: [PATCH 06/11] =?UTF-8?q?[FEAT]=20=EC=84=A0=EB=AC=BC=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20-=20=EC=A0=95=EB=A0=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopterm/makeawish/repository/GiftMenuRepository.java | 3 +++ src/main/java/com/sopterm/makeawish/service/CakeService.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sopterm/makeawish/repository/GiftMenuRepository.java b/src/main/java/com/sopterm/makeawish/repository/GiftMenuRepository.java index 70ca08b5..bc2fbc81 100644 --- a/src/main/java/com/sopterm/makeawish/repository/GiftMenuRepository.java +++ b/src/main/java/com/sopterm/makeawish/repository/GiftMenuRepository.java @@ -3,5 +3,8 @@ import com.sopterm.makeawish.domain.GiftMenu; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface GiftMenuRepository extends JpaRepository { + List findAllByOrderById(); } diff --git a/src/main/java/com/sopterm/makeawish/service/CakeService.java b/src/main/java/com/sopterm/makeawish/service/CakeService.java index 905a5781..48484833 100644 --- a/src/main/java/com/sopterm/makeawish/service/CakeService.java +++ b/src/main/java/com/sopterm/makeawish/service/CakeService.java @@ -169,7 +169,7 @@ private GiftMenu getGiftMenuInfo(Long giftMenuId) { } public List getAllGiftMenu() { - return giftMenuRepository.findAll().stream() + return giftMenuRepository.findAllByOrderById().stream() .map(GiftMenuResponseDTO::from) .collect(Collectors.toList()); } From f8d105d835f535ce697113593718d72b3a335c50 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:31:18 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[FEAT]=20=EC=84=A0=EB=AC=BC=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=ED=9B=84=20=EB=A6=AC=ED=84=B4=EA=B0=92=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 --- .../com/sopterm/makeawish/dto/cake/CakeCreateResponseDTO.java | 2 -- src/main/java/com/sopterm/makeawish/service/CakeService.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/dto/cake/CakeCreateResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/cake/CakeCreateResponseDTO.java index a4d79340..d9be66a2 100644 --- a/src/main/java/com/sopterm/makeawish/dto/cake/CakeCreateResponseDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/cake/CakeCreateResponseDTO.java @@ -6,8 +6,6 @@ public record CakeCreateResponseDTO( Long cakeId, String imageUrl, - String hint, - String initial, String wisher ) { } diff --git a/src/main/java/com/sopterm/makeawish/service/CakeService.java b/src/main/java/com/sopterm/makeawish/service/CakeService.java index 48484833..00e71fd3 100644 --- a/src/main/java/com/sopterm/makeawish/service/CakeService.java +++ b/src/main/java/com/sopterm/makeawish/service/CakeService.java @@ -161,7 +161,7 @@ public CakeCreateResponseDTO createPresent(CakeCreateRequest request) { .build(); presentRepository.save(present); wish.updateTotalPrice(giftMenu.getPrice()); - return new CakeCreateResponseDTO(cake.getId(), wish.getPresentImageUrl(), wish.getHint(), wish.getInitial(), wish.getWisher().getNickname()); + return new CakeCreateResponseDTO(cake.getId(), wish.getPresentImageUrl(), wish.getWisher().getNickname()); } private GiftMenu getGiftMenuInfo(Long giftMenuId) { From ea01321fc29d941fb442713b4329bc2b7f9d6d5a Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:33:08 +0900 Subject: [PATCH 08/11] =?UTF-8?q?[FEAT]=20=EC=86=8C=EC=9B=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=B9=BC=EB=9F=BC=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makeawish/dto/wish/UserWishUpdateRequestDTO.java | 2 -- .../makeawish/dto/wish/UserWishUpdateResponseDTO.java | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateRequestDTO.java b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateRequestDTO.java index 15d495e9..156a278f 100644 --- a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateRequestDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateRequestDTO.java @@ -13,8 +13,6 @@ public record UserWishUpdateRequestDTO( String imageUrl, Integer price, String title, - String hint, - String initial, boolean wantsGift ) { } diff --git a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateResponseDTO.java b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateResponseDTO.java index 29bfbb5c..011ed22f 100644 --- a/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateResponseDTO.java +++ b/src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateResponseDTO.java @@ -17,9 +17,6 @@ public record UserWishUpdateResponseDTO( AccountInfo accountInfo, String imageUrl, String title, - int price, - String initial, - String hint, WishStatus status ) { public static UserWishUpdateResponseDTO of(User user, Wish wish) { @@ -30,9 +27,6 @@ public static UserWishUpdateResponseDTO of(User user, Wish wish) { .accountInfo(nonNull(user.getAccount()) ? user.getAccount() : null) .imageUrl(wish.getPresentImageUrl()) .title(wish.getTitle()) - .price(wish.getPresentPrice()) - .initial(wish.getInitial()) - .hint(wish.getHint()) .status(wish.getStatus(0)) .build(); } From b8bc4a3da399fd93ec08d1c3a24bed670f7ee49e Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:37:47 +0900 Subject: [PATCH 09/11] =?UTF-8?q?[FEAT]=20=EC=86=8C=EC=9B=90=20=EC=B9=BC?= =?UTF-8?q?=EB=9F=BC=20=EA=B0=92=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopterm/makeawish/domain/wish/Wish.java | 25 +++---------------- .../makeawish/service/WishService.java | 2 +- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/domain/wish/Wish.java b/src/main/java/com/sopterm/makeawish/domain/wish/Wish.java index 59cc4bb1..0c0c18be 100644 --- a/src/main/java/com/sopterm/makeawish/domain/wish/Wish.java +++ b/src/main/java/com/sopterm/makeawish/domain/wish/Wish.java @@ -34,17 +34,10 @@ public class Wish extends BaseEntity { private String presentImageUrl; - @Column(columnDefinition = "TEXT") - private String hint; - - private String initial; - private LocalDateTime startAt; private LocalDateTime endAt; - private int presentPrice; - private int totalPrice; @ManyToOne(fetch = LAZY) @@ -57,15 +50,12 @@ public class Wish extends BaseEntity { private boolean wantsGift; @Builder - public Wish(String title, String presentImageUrl, String hint, String initial, LocalDateTime startAt, - LocalDateTime endAt, int presentPrice, User wisher, boolean wantsGift) { + public Wish(String title, String presentImageUrl, LocalDateTime startAt, + LocalDateTime endAt, User wisher, boolean wantsGift) { this.title = title; this.presentImageUrl = presentImageUrl; - this.hint = hint; - this.initial = initial; this.startAt = startAt; this.endAt = endAt; - this.presentPrice = presentPrice; this.totalPrice = 0; this.wantsGift = wantsGift; setWisher(wisher); @@ -94,22 +84,13 @@ public WishStatus getStatus(int expiryDay) { } } - public void updateContent(String imageUrl, Integer price, String title, String hint, String initial, boolean wantsGift) { + public void updateContent(String imageUrl, String title, boolean wantsGift) { if (nonNull(imageUrl)) { this.presentImageUrl = imageUrl; } - if (nonNull(price)) { - this.presentPrice = price; - } if (nonNull(title)) { this.title = title; } - if (nonNull(hint)) { - this.hint = hint; - } - if (nonNull(initial)) { - this.initial = initial; - } if(nonNull(wantsGift)) { this.wantsGift = wantsGift; } diff --git a/src/main/java/com/sopterm/makeawish/service/WishService.java b/src/main/java/com/sopterm/makeawish/service/WishService.java index 23a4d64f..ba42bb93 100644 --- a/src/main/java/com/sopterm/makeawish/service/WishService.java +++ b/src/main/java/com/sopterm/makeawish/service/WishService.java @@ -130,7 +130,7 @@ public UserWishUpdateResponseDTO updateUserMainWish(Long userId, UserWishUpdateR wish.updateTerm(startDate, endDate); } if (status.equals(BEFORE) || status.equals(WHILE)) { - wish.updateContent(request.imageUrl(), request.price(), request.title(), request.hint(), request.initial(), request.wantsGift()); + wish.updateContent(request.imageUrl(), request.title(), request.wantsGift()); wisher.updateProfile(request.name(), request.bankName(), request.account(), request.phone()); } From a30803a65273351efb7989f345119717aec29696 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:41:25 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[FEAT]=20optional=EA=B3=BC=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopterm/makeawish/repository/PresentRepository.java | 3 ++- src/main/java/com/sopterm/makeawish/service/CakeService.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sopterm/makeawish/repository/PresentRepository.java b/src/main/java/com/sopterm/makeawish/repository/PresentRepository.java index 43fa24fd..2d5df7ef 100644 --- a/src/main/java/com/sopterm/makeawish/repository/PresentRepository.java +++ b/src/main/java/com/sopterm/makeawish/repository/PresentRepository.java @@ -4,7 +4,8 @@ import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import java.util.Optional; public interface PresentRepository extends JpaRepository { - Present findPresentByWishIdAndId(Long wishId, Long presentId); + Optional findPresentByWishIdAndId(Long wishId, Long presentId); } diff --git a/src/main/java/com/sopterm/makeawish/service/CakeService.java b/src/main/java/com/sopterm/makeawish/service/CakeService.java index 00e71fd3..030f7467 100644 --- a/src/main/java/com/sopterm/makeawish/service/CakeService.java +++ b/src/main/java/com/sopterm/makeawish/service/CakeService.java @@ -143,7 +143,8 @@ public PresentResponseDTO getEachPresent(Long userId, Long wishId, Long presentI if (!isRightWisher(userId, wish)) { throw new IllegalArgumentException(INCORRECT_WISH.getMessage()); } - val present = presentRepository.findPresentByWishIdAndId(wishId, presentId); + val present = presentRepository.findPresentByWishIdAndId(wishId, presentId) + .orElseThrow(() -> new EntityNotFoundException(INVALID_GIFT_MENU.getMessage())); return PresentResponseDTO.from(present); } From 299372293deeda72b2943452c911cf0d5b857318 Mon Sep 17 00:00:00 2001 From: yang Jiyoung <0112jyoung@naver.com> Date: Wed, 11 Sep 2024 22:56:01 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[TEST]=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/com/sopterm/makeawish/config/CacheTest.java | 3 --- .../java/com/sopterm/makeawish/service/CakeServiceTest.java | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/test/java/com/sopterm/makeawish/config/CacheTest.java b/src/test/java/com/sopterm/makeawish/config/CacheTest.java index 9d23c170..a33b0bb5 100644 --- a/src/test/java/com/sopterm/makeawish/config/CacheTest.java +++ b/src/test/java/com/sopterm/makeawish/config/CacheTest.java @@ -73,9 +73,6 @@ private Wish createWish(User user) { .wisher(user) .presentImageUrl("image-url") .title("소원 제목") - .hint("소원 힌트") - .initial("ㅅㅇ ㅈㅁ") - .presentPrice(50000) .startAt(Util.convertToDate(getLocalDateTime(0))) .endAt(Util.convertToDate(getLocalDateTime(7))) .build(); diff --git a/src/test/java/com/sopterm/makeawish/service/CakeServiceTest.java b/src/test/java/com/sopterm/makeawish/service/CakeServiceTest.java index d346240b..c3dad7ab 100644 --- a/src/test/java/com/sopterm/makeawish/service/CakeServiceTest.java +++ b/src/test/java/com/sopterm/makeawish/service/CakeServiceTest.java @@ -147,9 +147,6 @@ private Wish createWish(User user){ .wisher(user) .presentImageUrl("image-url") .title("소원 제목") - .hint("소원 힌트") - .initial("ㅅㅇ ㅈㅁ") - .presentPrice(50000) .startAt(Util.convertToDate(getLocalDateTime(0))) .endAt(Util.convertToDate(getLocalDateTime(7))) .build();