Skip to content

Commit

Permalink
refact : 코드 리뷰에 대한 코드 리팩토링
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeongdong committed Jul 30, 2024
1 parent 74c06c3 commit a5c48af
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
import com.umc.naoman.domain.photo.entity.Photo;
import com.umc.naoman.domain.photo.repository.PhotoRepository;
import com.umc.naoman.domain.shareGroup.entity.ShareGroup;
import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository;
import com.umc.naoman.domain.shareGroup.service.ShareGroupService;
import com.umc.naoman.global.error.BusinessException;
import jakarta.persistence.EntityNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
Expand All @@ -28,14 +27,15 @@
import java.util.stream.Collectors;

import static com.umc.naoman.global.error.code.S3ErrorCode.PHOTO_NOT_FOUND_S3;
import static com.umc.naoman.global.error.code.ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND;

@Service
@RequiredArgsConstructor
public class PhotoServiceImpl implements PhotoService {

private final AmazonS3 amazonS3;
private final PhotoRepository photoRepository;
private final ShareGroupRepository shareGroupRepository;
private final ShareGroupService shareGroupService;
private final PhotoConverter photoConverter;

@Value("${spring.cloud.aws.s3.bucket}")
Expand All @@ -57,7 +57,11 @@ public List<PhotoResponse.PreSignedUrlInfo> getPreSignedUrlList(PhotoRequest.Pre
@Override
@Transactional
public PhotoResponse.PhotoUploadInfo uploadPhotoList(PhotoRequest.PhotoUploadRequest request) {
ShareGroup shareGroup = shareGroupRepository.findById(request.getShareGroupId()).orElseThrow(EntityNotFoundException::new);
ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId());
if (shareGroup == null) {
throw new BusinessException(SHARE_GROUP_NOT_FOUND);
}

int uploadCount = 0;

for (String photoUrl : request.getPhotoUrlList()) {
Expand Down

0 comments on commit a5c48af

Please sign in to comment.