Skip to content

Commit

Permalink
Merge pull request #173 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 66b24d7 + 67cf9d1 commit c5b3686
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.lesso.neverland.album.domain.Album;
import com.lesso.neverland.group.domain.Team;
import com.lesso.neverland.puzzle.domain.Puzzle;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface AlbumRepository extends JpaRepository<Album, Long> {
List<Album> findByTeamOrderByCreatedDateDesc(Team team);
boolean existsByPuzzle(Puzzle puzzle);
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ public BaseResponse<PuzzleDetailResponse> getPuzzleDetail(Long groupIdx, Long pu

boolean isWriter = puzzle.getUser().equals(user);
boolean hasWrite = puzzlePieceRepository.existsByPuzzleAndUser(puzzle, user);
boolean hasAlbum = albumRepository.existsByPuzzle(puzzle);

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), getMemberNicknameList(puzzle), puzzle.getPuzzleMembers().size(), puzzle.getPuzzlePieces().size()+1, isWriter, hasWrite,
getMemberImageList(puzzle), getMemberNicknameList(puzzle), puzzle.getPuzzleMembers().size(), puzzle.getPuzzlePieces().size()+1, isWriter, hasWrite, hasAlbum,
getPuzzlePieceList(puzzle));
return new BaseResponse<>(puzzleDetail);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public record PuzzleDetailResponse(String location,
Integer writeCount, // PuzzlePieceCount+1
boolean isWriter,
boolean hasWrite, // 해당 user가 퍼즐피스 작성했는지 여부
boolean hasAlbum,
List<PuzzlePieceDto> puzzlePieces) {}

0 comments on commit c5b3686

Please sign in to comment.