From f38b03d6ca49bffc61e7f02286c87b56d9f9c6b5 Mon Sep 17 00:00:00 2001 From: youngreal Date: Thu, 19 Dec 2024 22:37:43 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7fix:=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EB=AA=85=EC=86=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=95=88=EC=A7=80=EC=9B=8C=EC=A7=80=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dnd/dndtravel/map/controller/MapController.java | 5 ----- src/main/java/com/dnd/dndtravel/map/service/MapService.java | 1 + .../java/com/dnd/dndtravel/map/service/PhotoService.java | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/dnd/dndtravel/map/controller/MapController.java b/src/main/java/com/dnd/dndtravel/map/controller/MapController.java index 0cd11a6..7b6565e 100644 --- a/src/main/java/com/dnd/dndtravel/map/controller/MapController.java +++ b/src/main/java/com/dnd/dndtravel/map/controller/MapController.java @@ -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, diff --git a/src/main/java/com/dnd/dndtravel/map/service/MapService.java b/src/main/java/com/dnd/dndtravel/map/service/MapService.java index be0bb86..7c9a42e 100644 --- a/src/main/java/com/dnd/dndtravel/map/service/MapService.java +++ b/src/main/java/com/dnd/dndtravel/map/service/MapService.java @@ -172,6 +172,7 @@ public void deleteRecord(long memberId, long memberAttractionId) { List photos = photoRepository.findByMemberAttractionId(memberAttraction.getId()); photoRepository.deleteAll(photos); memberAttractionRepository.delete(memberAttraction); + memberRegionRepository.deleteById(memberAttraction.getMember().getId()); attractionRepository.deleteById(memberAttraction.getAttraction().getId()); } diff --git a/src/main/java/com/dnd/dndtravel/map/service/PhotoService.java b/src/main/java/com/dnd/dndtravel/map/service/PhotoService.java index 13284ec..92d4778 100644 --- a/src/main/java/com/dnd/dndtravel/map/service/PhotoService.java +++ b/src/main/java/com/dnd/dndtravel/map/service/PhotoService.java @@ -45,7 +45,7 @@ public String upload(MultipartFile image) { public void deleteS3Photo(List existingUrls) { for (String existingPhotoUrl : existingUrls) { // 기존 이미지 URL에서 파일 이름 추출 - String existingFileName = existingPhotoUrl.substring(existingPhotoUrl.lastIndexOf('/') + 1);; + String existingFileName = existingPhotoUrl.substring(existingPhotoUrl.lastIndexOf('/') + 1); // S3에서 기존 이미지 삭제 try {