Skip to content

Commit

Permalink
refactor: 메서드명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ajy9851 committed Nov 8, 2024
1 parent 4a191d5 commit 40c7898
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface OrderDetailRepository extends JpaRepository<OrderDetail, Long>
@EntityGraph(attributePaths = {"spot"})
Page<OrderDetail> findAllByMember(Member member, Pageable pageable);

Optional<OrderDetail> findFirstBySpotAndMember(
Optional<OrderDetail> findBySpotAndMember(
Spot spot, Member member); // 한 스팟에 여러 멤버가 못들어가는지 확인하고 First빼야 함

List<OrderDetail> findAllBySpot(Spot spot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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("주문의 참여자가 아닙니다.");
Expand Down

0 comments on commit 40c7898

Please sign in to comment.