From 22b7441ad20f7043f1dbfba8b30bee861ed10749 Mon Sep 17 00:00:00 2001 From: kimjm9841 Date: Sat, 3 Feb 2024 00:32:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=94=BC=EB=93=9C=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20API=20=EC=9D=91=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/off/feed/controller/FeedController.java | 11 +++++------ .../onnoff/domain/off/feed/service/FeedService.java | 2 +- .../domain/off/feed/service/FeedServiceImpl.java | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/onnoff/onnoff/domain/off/feed/controller/FeedController.java b/src/main/java/com/onnoff/onnoff/domain/off/feed/controller/FeedController.java index 32b66de..c44bf19 100644 --- a/src/main/java/com/onnoff/onnoff/domain/off/feed/controller/FeedController.java +++ b/src/main/java/com/onnoff/onnoff/domain/off/feed/controller/FeedController.java @@ -28,8 +28,8 @@ public ApiResponse addFeed(@RequestBody @Valid Fe } @GetMapping("/feeds") - @Operation(summary = "워라벨 피드 조회 API",description = "특정한 날짜의 워라벨 피드를 조회하는 API입니다. Query String으로 날짜를 입력해 주세요.") - public ApiResponse> getFeed(@RequestParam(name = "date") LocalDate date){ + @Operation(summary = "워라벨 피드 조회 API", description = "특정한 날짜의 워라벨 피드를 조회하는 API입니다. Query String으로 날짜를 입력해 주세요.") + public ApiResponse> getFeed(@RequestParam(name = "date") LocalDate date) { List feedList = feedService.getFeed(date); return ApiResponse.onSuccess(feedList.stream().map(FeedConverter::toFeedResultDTO).toList()); } @@ -42,9 +42,8 @@ public ApiResponse modifyFeed(@RequestBody @Valid } @DeleteMapping("/feeds/{feedId}") - @Operation(summary = "워라벨 피드 삭제 API",description = "기존의 워라벨 피드를 삭제하는 API입니다.") - public ApiResponse deleteFeed(@PathVariable(name = "feedId") Long feedId){ - feedService.deleteFeed(feedId); - return ApiResponse.onSuccess(null); + @Operation(summary = "워라벨 피드 삭제 API", description = "기존의 워라벨 피드를 삭제하는 API입니다.") + public ApiResponse deleteFeed(@PathVariable(name = "feedId") Long feedId) { + return ApiResponse.onSuccess(feedService.deleteFeed(feedId)); } } diff --git a/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedService.java b/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedService.java index a36a29a..deabce3 100644 --- a/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedService.java +++ b/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedService.java @@ -15,5 +15,5 @@ public interface FeedService { Feed modifyFeed(FeedRequestDTO.ModifyFeedDTO request); - void deleteFeed(Long feedId); + Long deleteFeed(Long feedId); } diff --git a/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedServiceImpl.java b/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedServiceImpl.java index 0feed24..f2a6512 100644 --- a/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedServiceImpl.java +++ b/src/main/java/com/onnoff/onnoff/domain/off/feed/service/FeedServiceImpl.java @@ -49,8 +49,10 @@ public Feed modifyFeed(FeedRequestDTO.ModifyFeedDTO request) { @Override @Transactional - public void deleteFeed(Long feedId) { + public Long deleteFeed(Long feedId) { Feed feed = feedRepository.findById(feedId).orElseThrow(() -> new GeneralException(ErrorStatus.FEED_NOT_FOUND)); feedRepository.delete(feed); + + return feed.getId(); } }