Skip to content

Commit

Permalink
기본 이미지 삭제하지 않는 기능 추가 (#727)
Browse files Browse the repository at this point in the history
* refactor: 기본 이미지 삭제하지 않는 기능 추가

* refactor: 상수화 적용
  • Loading branch information
jjongwa authored Oct 19, 2023
1 parent 7c44150 commit 563a140
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/backend-submodule
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void publishTrip(final PublishEvent publishEvent) {
}

@EventListener
public void publishDeleteTrip(final PublishDeleteEvent publishDeleteEvent) {
public void deletePublishedTrip(final PublishDeleteEvent publishDeleteEvent) {
publishedTripRepository.deleteByTripId(publishDeleteEvent.getTripId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
@RequiredArgsConstructor
public class S3ImageEventListener {

private static final String DEFAULT_IMAGE_NAME = "default-image.png";

private final AmazonS3 s3Client;

@Value("${cloud.aws.s3.bucket}")
Expand All @@ -28,6 +30,9 @@ public class S3ImageEventListener {
@TransactionalEventListener(fallbackExecution = true)
public void deleteImageFileInS3(final S3ImageEvent event) {
final String imageName = event.getImageName();
if (imageName.equals(DEFAULT_IMAGE_NAME)) {
return;
}
s3Client.deleteObject(bucket, folder + imageName);
}
}

0 comments on commit 563a140

Please sign in to comment.