Skip to content

Commit

Permalink
API - v0.1.5-2
Browse files Browse the repository at this point in the history
API - v0.1.5-2
  • Loading branch information
wjdtkdgns authored Aug 25, 2023
2 parents 75c829d + 037165e commit 7f43ba4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,19 @@ public void execute(ClearDeletedObjectRequest request) {

private void deleteS3Object(List<Content> contents, List<Archiving> archivings) {
List<String> imageKeys =
archivings.stream()
.map(Archiving::getImageUrl)
new ArrayList<>(
archivings.stream()
.map(Archiving::getImageUrl)
.filter(url -> !url.isEmpty())
.filter(url -> !url.startsWith("http"))
.toList());
imageKeys.addAll(
contents.stream()
.filter(content -> content.getContentType().equals(ContentType.IMAGE))
.map(Content::getImageUrl)
.filter(url -> !url.isEmpty())
.filter(url -> !url.startsWith("http"))
.toList();
contents.stream()
.filter(content -> content.getContentType().equals(ContentType.IMAGE))
.map(Content::getImageUrl)
.filter(url -> !url.startsWith("http"))
.filter(url -> !url.isEmpty())
.forEach(imageKeys::add);
.toList());
s3DeleteObjectService.deleteS3Object(imageKeys);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ public void executeSchedule() {

private void deleteS3Object(List<Content> contents, List<Archiving> archivings) {
List<String> imageKeys =
archivings.stream()
.map(Archiving::getImageUrl)
new ArrayList<>(
archivings.stream()
.map(Archiving::getImageUrl)
.filter(url -> !url.isEmpty())
.filter(url -> !url.startsWith("http"))
.toList());
imageKeys.addAll(
contents.stream()
.filter(content -> content.getContentType().equals(ContentType.IMAGE))
.map(Content::getImageUrl)
.filter(url -> !url.isEmpty())
.filter(url -> !url.startsWith("http"))
.toList();
contents.stream()
.filter(content -> content.getContentType().equals(ContentType.IMAGE))
.map(Content::getImageUrl)
.filter(url -> !url.isEmpty())
.filter(url -> !url.startsWith("http"))
.forEach(imageKeys::add);
.toList());
s3DeleteObjectService.deleteS3Object(imageKeys);
}

Expand Down

0 comments on commit 7f43ba4

Please sign in to comment.