From 40c78985195af8b247d9c76a3a98b0ea42fcc63f Mon Sep 17 00:00:00 2001 From: ajy9851 Date: Fri, 8 Nov 2024 16:58:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/details/repository/OrderDetailRepository.java | 2 +- .../order/details/service/OrderDetailService.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ordertogether/team14_be/order/details/repository/OrderDetailRepository.java b/src/main/java/com/ordertogether/team14_be/order/details/repository/OrderDetailRepository.java index e6501c47..69f8a466 100644 --- a/src/main/java/com/ordertogether/team14_be/order/details/repository/OrderDetailRepository.java +++ b/src/main/java/com/ordertogether/team14_be/order/details/repository/OrderDetailRepository.java @@ -16,7 +16,7 @@ public interface OrderDetailRepository extends JpaRepository @EntityGraph(attributePaths = {"spot"}) Page findAllByMember(Member member, Pageable pageable); - Optional findFirstBySpotAndMember( + Optional findBySpotAndMember( Spot spot, Member member); // 한 스팟에 여러 멤버가 못들어가는지 확인하고 First빼야 함 List findAllBySpot(Spot spot); diff --git a/src/main/java/com/ordertogether/team14_be/order/details/service/OrderDetailService.java b/src/main/java/com/ordertogether/team14_be/order/details/service/OrderDetailService.java index b831e3e8..2fdce15b 100644 --- a/src/main/java/com/ordertogether/team14_be/order/details/service/OrderDetailService.java +++ b/src/main/java/com/ordertogether/team14_be/order/details/service/OrderDetailService.java @@ -100,7 +100,7 @@ public GetParticipantOrderInfoRes getParticipantOrderInfo(Member member, Long sp OrderDetail orderDetail = orderDetailRepository - .findFirstBySpotAndMember(spot, member) + .findBySpotAndMember(spot, member) .orElseThrow(() -> new IllegalArgumentException("주문 정보가 없습니다.")); return new GetParticipantOrderInfoRes( @@ -146,8 +146,10 @@ public GetCreatorOrderInfoRes getCreatorOrderInfo(Member member, Long spotId) { @Transactional public void updateOrderPrice(Member member, UpdateOrderPriceReq dto) { - OrderDetail orderDetail = orderDetailRepository.findById(dto.orderId()) - .orElseThrow(() -> new IllegalArgumentException("주문 정보를 찾을 수 없습니다.")); + OrderDetail orderDetail = + orderDetailRepository + .findById(dto.orderId()) + .orElseThrow(() -> new IllegalArgumentException("주문 정보를 찾을 수 없습니다.")); if (!orderDetail.getMember().getId().equals(member.getId())) { throw new IllegalArgumentException("주문의 참여자가 아닙니다.");