Skip to content

Commit

Permalink
Merge pull request #86 from Hanaro-trip-together-bank/feature/trip-place
Browse files Browse the repository at this point in the history
fix: 여행 일정res에 댓글 수 추가
  • Loading branch information
mummhy0811 authored May 31, 2024
2 parents d2cbdea + 5eba35a commit a6b8c61
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class TripPlaceResDto {
private Long placeIdx;
private BigDecimal placeAmount;
private String placeMemo;
private int replyCount;

@Builder
public TripPlaceResDto(TripPlace tripPlace) {
Expand All @@ -23,5 +24,6 @@ public TripPlaceResDto(TripPlace tripPlace) {
this.placeIdx = tripPlace.getPlace().toPlace().getPlaceIdx();
this.placeAmount = tripPlace.getPlaceAmount();
this.placeMemo = tripPlace.getPlaceMemo();
this.replyCount = tripPlace.getTripReplies().size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,6 @@ public void updatePlace(Long trip_placeIdx, TripPlaceUpdateReqDto dto) {
tripPlace.update(place, dto.getPlaceAmount(), dto.getPlaceMemo(), member);
}

// @Transactional
// public void updatePlaceOrder(Long tripIdx, UpdateOrderReqDto dto) {
//
// Trip trip = tripService.findByTripIdx(tripIdx);
//
// validateTeamMember(trip.getTeam(), dto.getMemberIdx());
// validateTripDate(trip, dto.getTripDate());
//
// List<TripPlaceOrderReqDto> dtos = dto.getOrders();
// Member member = memberService.findByMemberIdx(dto.getMemberIdx());
// int num = tripPlaceRepository.countByTripId(tripIdx, dto.getTripDate());
// if (dtos.stream().map(TripPlaceOrderReqDto::getTripPlaceIdx).distinct().count() != num){ //중복 및 사이즈 체크
// throw new ApiException(ExceptionEnum.INVALID_ORDER_LIST);
// }
// for(int i=0;i<dtos.size();i++){
// TripPlace tripPlace = checkTripPlaceExists(dtos.get(i).getTripPlaceIdx());
// if(!Objects.equals(tripPlace.getTrip().getTripIdx(), tripIdx)){
// throw new ApiException(ExceptionEnum.TEAM_NOT_MATCH);
// }
// tripPlace.updateOrder(i+1, member);
// }
// }
@Transactional
public void updatePlaceOrder(Long tripIdx, UpdateOrderReqDto reqDto) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
@Repository
public interface TripReplyRepository extends JpaRepository<TripReply, Long> {
List<TripReply> findAllByTripPlace_TripPlaceIdxOrderByCreatedAtAsc(Long trip_place_idx);
Long countByTripPlace_TripPlaceIdx(Long trip_place_idx);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.hanaro.triptogether.tripPlace.dto.request.TripPlaceUpdateReqDto;
import com.hanaro.triptogether.tripPlace.dto.request.UpdateOrderReqDto;
import com.hanaro.triptogether.tripPlace.dto.response.TripPlaceResDto;
import com.hanaro.triptogether.tripReply.domain.TripReply;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -309,6 +310,7 @@ private TripPlace createMockTripPlace(Long tripPlaceIdx) {
.placeAmount(BigDecimal.valueOf(50)) // 임의의 초기 값 설정
.placeMemo("Previous Memo") // 임의의 초기 값 설정
.createdBy(member1)
.tripReplies(List.of(mock(TripReply.class)))
.build();
}

Expand Down

0 comments on commit a6b8c61

Please sign in to comment.