diff --git a/src/main/java/com/lesso/neverland/album/repository/AlbumRepository.java b/src/main/java/com/lesso/neverland/album/repository/AlbumRepository.java index cc7cbd1..15d1860 100644 --- a/src/main/java/com/lesso/neverland/album/repository/AlbumRepository.java +++ b/src/main/java/com/lesso/neverland/album/repository/AlbumRepository.java @@ -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 { List findByTeamOrderByCreatedDateDesc(Team team); + boolean existsByPuzzle(Puzzle puzzle); } diff --git a/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java b/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java index 9a87b81..47504c0 100644 --- a/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java +++ b/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java @@ -102,10 +102,11 @@ public BaseResponse 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); } diff --git a/src/main/java/com/lesso/neverland/puzzle/dto/PuzzleDetailResponse.java b/src/main/java/com/lesso/neverland/puzzle/dto/PuzzleDetailResponse.java index eabd472..cdb2fb7 100644 --- a/src/main/java/com/lesso/neverland/puzzle/dto/PuzzleDetailResponse.java +++ b/src/main/java/com/lesso/neverland/puzzle/dto/PuzzleDetailResponse.java @@ -14,4 +14,5 @@ public record PuzzleDetailResponse(String location, Integer writeCount, // PuzzlePieceCount+1 boolean isWriter, boolean hasWrite, // 해당 user가 퍼즐피스 작성했는지 여부 + boolean hasAlbum, List puzzlePieces) {}