Skip to content

Commit

Permalink
[fix] 종료된 선물방 response 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hysong4u committed Jan 15, 2024
1 parent ca4cb3f commit 4fa8422
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ResponseEntity<SuccessResponse<?>> getMyGift(
required = true,
example = "12345"
) @UserId Long userId,
@Valid @RequestBody MyGiftsRequestDto myGiftsRequestDto
@Valid @PathVariable Long roomId
);

@Operation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public record ClosedRoomResponseDto(
Long roomId,
String imageUrl,
String gifteeName,
int gifterNumber
int gifterNumber,
Boolean isOwner
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ public List<ClosedRoomResponseDto> getClosedRoom(Long memberId) {
.map(RoomMember::getRoom)
.filter(room -> room.getDeliveryDate().isBefore(LocalDateTime.now()))
.sorted(Comparator.comparing(Room::getDeliveryDate).reversed())
.map(this::mapToClosedRoomResponseDto)
.map(room -> mapToClosedRoomResponseDto(room, memberId))
.collect(Collectors.toList());
return closedRooms;
}

private ClosedRoomResponseDto mapToClosedRoomResponseDto(Room room) {
private ClosedRoomResponseDto mapToClosedRoomResponseDto(Room room, Long memberId){
return new ClosedRoomResponseDto(
room.getId(),
room.getImageUrl(),
room.getGifteeName(),
room.getGifterNumber()
room.getGifterNumber(),
isOwner(memberId, room.getId())
);
}

Expand Down

0 comments on commit 4fa8422

Please sign in to comment.