Skip to content

Commit

Permalink
🔧fix: 기록 삭제시 명소기록 안지워지는 문제해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youngreal committed Dec 19, 2024
1 parent fdf10a4 commit f38b03d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public void updateRecord(
mapService.updateVisitRecord(updateRecordRequest.toDto(photos), authenticationMember.id(), recordId);
}

// 기록 삭제

/**
* org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' is not supported 예외로 인해 PostMapping으로 변경
*/
@DeleteMapping("/maps/history/{recordId}")
public void deleteRecord(
AuthenticationMember authenticationMember,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public void deleteRecord(long memberId, long memberAttractionId) {
List<Photo> photos = photoRepository.findByMemberAttractionId(memberAttraction.getId());
photoRepository.deleteAll(photos);
memberAttractionRepository.delete(memberAttraction);
memberRegionRepository.deleteById(memberAttraction.getMember().getId());
attractionRepository.deleteById(memberAttraction.getAttraction().getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String upload(MultipartFile image) {
public void deleteS3Photo(List<String> existingUrls) {
for (String existingPhotoUrl : existingUrls) {
// 기존 이미지 URL에서 파일 이름 추출
String existingFileName = existingPhotoUrl.substring(existingPhotoUrl.lastIndexOf('/') + 1);;
String existingFileName = existingPhotoUrl.substring(existingPhotoUrl.lastIndexOf('/') + 1);

// S3에서 기존 이미지 삭제
try {
Expand Down

0 comments on commit f38b03d

Please sign in to comment.