Skip to content

Commit

Permalink
fix : 사진 삭제 순서 변경, 메서드 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeongdong committed Aug 13, 2024
1 parent 1b0d58b commit 5d2c924
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public interface PhotoService {
List<Photo> deletePhotoList(PhotoRequest.PhotoDeletedRequest request, Member member);

// 사진 목록에서 특정 회원의 사진을 삭제하는 함수
void deletePhotoByFaceTag(Long memberId);
void deletePhotoListByFaceTag(Long memberId);

// 특정 공유 그룹의 모든 사진을 삭제하는 함수
void deletePhotoByShareGroupId(Long shareGroupIdList);
void deletePhotoListByShareGroupId(Long shareGroupId);

Photo findPhoto(Long photoId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,34 +289,36 @@ public List<Photo> deletePhotoList(PhotoDeletedRequest request, Member member) {

@Override
@Transactional
public void deletePhotoByFaceTag(Long memberId) {
public void deletePhotoListByFaceTag(Long memberId) {
// Elasticsearch 사진 데이터 삭제
List<Long> photoIdList = photoEsClientRepository.deletePhotoEsByFaceTag(memberId);

// RDBMS 사진 데이터 삭제
List<Photo> photoList = photoRepository.findByIdIn(photoIdList);
photoRepository.deleteAllByPhotoIdList(photoIdList);

// S3 버킷 사진 데이터 삭제
for (Photo photo : photoList) {
deletePhoto(photo.getName());
}

// RDBMS 사진 데이터 삭제
photoRepository.deleteAllByPhotoIdList(photoIdList);
}

@Override
@Transactional
public void deletePhotoByShareGroupId(Long shareGroupId) {
public void deletePhotoListByShareGroupId(Long shareGroupId) {
// Elasticsearch 사진 데이터 삭제
List<Long> photoIdList = photoEsClientRepository.deletePhotoEsByShareGroupId(shareGroupId);

// RDBMS 사진 데이터 삭제
List<Photo> photoList = photoRepository.findByIdIn(photoIdList);
photoRepository.deleteAllByPhotoIdList(photoIdList);

// S3 버킷 사진 데이터 삭제
for (Photo photo : photoList) {
deletePhoto(photo.getName());
}

// RDBMS 사진 데이터 삭제
photoRepository.deleteAllByPhotoIdList(photoIdList);
}

private void deletePhoto(String photoName) {
Expand Down

0 comments on commit 5d2c924

Please sign in to comment.