Skip to content

Commit

Permalink
Merge pull request #168 from lemonssoju/fix/87-getPuzzleDetail
Browse files Browse the repository at this point in the history
[fix/87-getPuzzleDetail] 퍼즐 상세 조회 시 멤버 닉네임 목록도 함께 반환하도록 수정
  • Loading branch information
JoongHyun-Kim authored Jun 3, 2024
2 parents 4f2ff5a + ffe2c47 commit a0bf3e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public BaseResponse<PuzzleDetailResponse> getPuzzleDetail(Long groupIdx, Long pu

PuzzleDetailResponse puzzleDetail = new PuzzleDetailResponse(puzzle.getLocation().getLocation(), puzzle.getPuzzleImage(),
puzzle.getPuzzleDate().toString(), puzzle.getCreatedDate().toString(), puzzle.getUser().getProfile().getNickname(), puzzle.getTitle(), puzzle.getContent(),
getMemberImageList(puzzle), puzzle.getPuzzleMembers().size(), puzzle.getPuzzlePieces().size()+1, isWriter, hasWrite,
getMemberImageList(puzzle), getMemberNicknameList(puzzle), puzzle.getPuzzleMembers().size(), puzzle.getPuzzlePieces().size()+1, isWriter, hasWrite,
getPuzzlePieceList(puzzle));
return new BaseResponse<>(puzzleDetail);
}
Expand All @@ -132,6 +132,11 @@ private List<String> getMemberImageList(Puzzle puzzle) {
return imageList;
}

private List<String> getMemberNicknameList(Puzzle puzzle) {
return puzzle.getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getNickname()).toList();
}

// 퍼즐 생성
@Transactional(rollbackFor = Exception.class)
public BaseResponse<String> createPuzzle(Long groupIdx, MultipartFile image, CreatePuzzleRequest createPuzzleRequest) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record PuzzleDetailResponse(String location,
String title,
String content,
List<String> memberImageList, // 3명만
List<String> memberNicknameList,
Integer memberCount,
Integer writeCount, // PuzzlePieceCount+1
boolean isWriter,
Expand Down

0 comments on commit a0bf3e0

Please sign in to comment.