Skip to content

Commit

Permalink
[FIX] 잔여좌석 조회 로직 수정
Browse files Browse the repository at this point in the history
- 객체 단위 contains() -> id 단위로 변경
  • Loading branch information
c0smosaur authored Jun 12, 2024
1 parent d22dadf commit 08fab71
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,18 @@ private List<SeatSpaceResponse> getSeatSpacesFromDate(
reservationRepository.findAllSeatSpacesByOfficeIdAndType(
officeId, String.valueOf(SeatSpaceType.fromKor(type)), startDate, endDate);

Set<Long> availableSeatSpaceIds = availableSeatSpaces.stream()
.map(SeatSpace::getId)
.collect(Collectors.toSet());

// 전체 좌석 리스트와 잔여 좌석 리스트
// 잔여 좌석 리스트에 있으면 해당 좌석 true
return allSeatSpaces.stream().map(
seatSpace -> SeatSpaceResponse.builder()
.id(seatSpace.getId())
.code(seatSpace.getCode())
.type(seatSpace.getType().getTypeName())
.isAvailable(availableSeatSpaces.contains(seatSpace))
.isAvailable(availableSeatSpaceIds.contains(seatSpace.getId()))
.build()
).toList();
}
Expand Down

0 comments on commit 08fab71

Please sign in to comment.