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 7852de5..5bb8495 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 @@ -170,8 +170,9 @@ public PhotoUploadInfo uploadPhotoList(PhotoUploadRequest request, Member member long startTime = System.currentTimeMillis(); // 사진 URL 리스트를 기반으로 사진 엔티티를 생성하고 DB에 저장 List photoList = request.getPhotoUrlList().stream() - .map(photoUrl -> checkAndSavePhotoInDB(photoUrl, extractPhotoNameFromUrl(photoUrl), shareGroup)) + .map(photoUrl -> checkAndCreatePhoto(photoUrl, extractPhotoNameFromUrl(photoUrl), shareGroup)) .toList(); + photoRepository.saveAll(photoList); long finishTime = System.currentTimeMillis(); log.info("저장한 사진 개수: {} 장", photoList.size()); log.info("해당 사진 목록을 DB에 저장하는 데 걸린 시간: {} ms", finishTime - startTime); @@ -197,7 +198,8 @@ public PhotoUploadInfo uploadPhotoList(PhotoUploadRequest request, Member member } // S3에 객체의 존재 여부 확인 및 DB에 사진을 저장하고 객체를 반환하는 메서드 - private Photo checkAndSavePhotoInDB(String photoUrl, String photoName, ShareGroup shareGroup) { +// private Photo checkAndSavePhotoInDB(String photoUrl, String photoName, ShareGroup shareGroup) { + private Photo checkAndCreatePhoto(String photoUrl, String photoName, ShareGroup shareGroup) { long startTime = System.currentTimeMillis(); if (!amazonS3.doesObjectExist(BUCKET_NAME, RAW_PATH_PREFIX + "/" + photoName)) { throw new BusinessException(PHOTO_NOT_FOUND_S3); @@ -205,8 +207,9 @@ private Photo checkAndSavePhotoInDB(String photoUrl, String photoName, ShareGrou long finishTime = System.currentTimeMillis(); log.info("amazonS3.doesObjectExists() 수행 시간: {} ms", finishTime - startTime); - Photo photo = photoConverter.toEntity(photoUrl, photoName, shareGroup); - return photoRepository.save(photo); // 저장된 Photo 객체 반환 + return photoConverter.toEntity(photoUrl, photoName, shareGroup); +// Photo photo = photoConverter.toEntity(photoUrl, photoName, shareGroup); +// return photoRepository.save(photo); // 저장된 Photo 객체 반환 } // 사진 URL에서 사진 이름을 추출하는 메서드