diff --git a/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java b/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java index 90824c9..7328d0d 100644 --- a/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java +++ b/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.stream.Collectors; @@ -64,6 +65,8 @@ public PhotoResponse.PagedPhotoEsInfo toPagedPhotoEsInfo(Page photoEsLi public PhotoResponse.PhotoEsInfo toPhotoEsInfo(PhotoEs photoEs, Member member) { String rawUrl = photoEs.getUrl(); Boolean isDownload = !photoEs.getDownloadTag().isEmpty() && photoEs.getDownloadTag().contains(member.getId()); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime createdAt = LocalDateTime.parse(photoEs.getCreatedAt(), dateTimeFormatter); return PhotoResponse.PhotoEsInfo.builder() .photoId(photoEs.getRdsId()) @@ -71,11 +74,10 @@ public PhotoResponse.PhotoEsInfo toPhotoEsInfo(PhotoEs photoEs, Member member) { .w200PhotoUrl(createResizedPhotoUrl(rawUrl, W200_PATH_PREFIX)) .w400PhotoUrl(createResizedPhotoUrl(rawUrl, W400_PATH_PREFIX)) .isDownload(isDownload) - .createdAt(LocalDateTime.parse(photoEs.getCreatedAt())) + .createdAt(createdAt) .build(); } - private String createResizedPhotoUrl(String photoUrl, String size) { String resizedUrl = getResizedUrl(photoUrl, size); return convertExtension(resizedUrl); 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 053583e..2b03ff7 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 @@ -185,7 +185,7 @@ private String extractPhotoNameFromUrl(String photoUrl) { // S3에 객체의 존재 여부 확인 및 DB에 사진을 저장하고 객체를 반환하는 메서드 private Photo checkAndSavePhotoInDB(String photoUrl, String photoName, ShareGroup shareGroup) { - if (amazonS3.doesObjectExist(bucketName, RAW_PATH_PREFIX + "/" + photoName)) { + if (!amazonS3.doesObjectExist(bucketName, RAW_PATH_PREFIX + "/" + photoName)) { throw new BusinessException(PHOTO_NOT_FOUND_S3); }