Skip to content

Commit

Permalink
[merge] 사진저장로직 수정 - #216
Browse files Browse the repository at this point in the history
[fix] 사진저장로직 수정 - #216
  • Loading branch information
rlarlgnszx authored Aug 13, 2024
2 parents 187f727 + c063061 commit 4adc498
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ImageService {
@Value("${cloudfront.domain}")
private String cachePath;

@Transactional
public List<Image> saveImages(final List<MultipartFile> images, final Course course) {
AtomicInteger sequence = new AtomicInteger(1);
List<CompletableFuture<Image>> futureImages = images.stream()
Expand All @@ -44,8 +45,10 @@ public List<Image> saveImages(final List<MultipartFile> images, final Course cou
throw new BadRequestException(FailureCode.BAD_REQUEST);
}
})).toList();
return futureImages.stream()
List<Image> saveImages = futureImages.stream()
.map(CompletableFuture::join)
.toList();
imageRepository.saveAll(saveImages);
return saveImages;
}
}

0 comments on commit 4adc498

Please sign in to comment.