From 78f605332e27dc68f4bbf33661b84d84e4197c9d Mon Sep 17 00:00:00 2001 From: HongYeseul Date: Tue, 6 Aug 2024 12:36:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(DiaryImageService):=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EA=B0=80=20=EC=9E=88?= =?UTF-8?q?=EB=8A=94=20=EC=9D=BC=EA=B8=B0=20PATCH=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20-=20?= =?UTF-8?q?=EC=9E=98=EB=AA=BB=20=EB=93=A4=EC=96=B4=EA=B0=80=EC=9E=88?= =?UTF-8?q?=EB=8A=94=20=EB=B3=80=EC=88=98=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=20=20:=20diaryImage.id=20->=20image.id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grassdiary/domain/image/service/DiaryImageService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/chzzk/grassdiary/domain/image/service/DiaryImageService.java b/src/main/java/chzzk/grassdiary/domain/image/service/DiaryImageService.java index 61c784ad..f2003659 100644 --- a/src/main/java/chzzk/grassdiary/domain/image/service/DiaryImageService.java +++ b/src/main/java/chzzk/grassdiary/domain/image/service/DiaryImageService.java @@ -31,7 +31,7 @@ public void mappingImageToDiary(Diary diary, Long imageId) { public void deleteImageAndMapping(Diary diary) { diaryToImageDAO.findByDiaryId(diary.getId()).ifPresent(diaryImage -> { - imageService.deleteImage(diaryImage.getId()); + imageService.deleteImage(diaryImage.getImage().getId()); diaryToImageDAO.delete(diaryImage); }); } From 3558550b75848c2fe792742801c984c6289f2c0e Mon Sep 17 00:00:00 2001 From: HongYeseul Date: Tue, 6 Aug 2024 12:36:27 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor(ImageController):=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=20=EC=97=86=EB=8A=94=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/image/controller/ImageController.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/chzzk/grassdiary/domain/image/controller/ImageController.java b/src/main/java/chzzk/grassdiary/domain/image/controller/ImageController.java index ebe2abd5..c2f625bc 100644 --- a/src/main/java/chzzk/grassdiary/domain/image/controller/ImageController.java +++ b/src/main/java/chzzk/grassdiary/domain/image/controller/ImageController.java @@ -10,9 +10,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; @@ -40,14 +38,6 @@ public ResponseEntity uploadDiaryImage( .body(imageService.uploadImage(image, FileFolder.PERSONAL_DIARY)); } - @DeleteMapping("/diary/{diaryId}") - public ResponseEntity deleteDiaryImage( - @PathVariable Long diaryId - ) { - imageService.deleteImage(diaryId); - return ResponseEntity.ok().build(); - } - private ResponseEntity sendImage(String mainBannerUrl) throws IOException { Resource resource = new ClassPathResource(mainBannerUrl); if (!resource.exists()) {