diff --git a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java index 8bf2a2b..8ce9b33 100644 --- a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java @@ -243,12 +243,25 @@ public PhotoDownloadUrlListInfo getPhotoDownloadUrlList(List photoIdList, @Override public PhotoDownloadUrlListInfo getPhotoDownloadUrlListByShareGroup(Long shareGroupId, Member member) { validateShareGroupAndProfile(shareGroupId, member); - List photoList = photoRepository.findByShareGroupId(shareGroupId); - List photoUrlList = photoList.stream() - .map(Photo::getUrl) + List photoEsList = new ArrayList<>(); + Pageable pageable = Pageable.ofSize(5000); + boolean isLastPage = false; + + while (!isLastPage) { + Page photoEsPage = photoEsClientRepository.findPhotoEsByShareGroupId(shareGroupId, pageable); + photoEsList.addAll(photoEsPage.getContent()); + isLastPage = photoEsPage.isLast(); + + // 다음 페이지로 이동 + pageable = pageable.next(); + } + + List photoUrlList = photoEsList.stream() + .map(PhotoEs::getUrl) .collect(Collectors.toList()); + // 사진 다운로드 이력 추가 photoEsClientRepository.addDownloadTag(photoUrlList, member.getId()); return photoConverter.toPhotoDownloadUrlListInfo(photoUrlList);