Skip to content

Commit

Permalink
feat: 피드 삭제 API 응답 데이터 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjm9841 committed Feb 2, 2024
1 parent 1c35a28 commit 22b7441
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public ApiResponse<FeedResponseDTO.FeedResultDTO> addFeed(@RequestBody @Valid Fe
}

@GetMapping("/feeds")
@Operation(summary = "워라벨 피드 조회 API",description = "특정한 날짜의 워라벨 피드를 조회하는 API입니다. Query String으로 날짜를 입력해 주세요.")
public ApiResponse<List<FeedResponseDTO.FeedResultDTO>> getFeed(@RequestParam(name = "date") LocalDate date){
@Operation(summary = "워라벨 피드 조회 API", description = "특정한 날짜의 워라벨 피드를 조회하는 API입니다. Query String으로 날짜를 입력해 주세요.")
public ApiResponse<List<FeedResponseDTO.FeedResultDTO>> getFeed(@RequestParam(name = "date") LocalDate date) {
List<Feed> feedList = feedService.getFeed(date);
return ApiResponse.onSuccess(feedList.stream().map(FeedConverter::toFeedResultDTO).toList());
}
Expand All @@ -42,9 +42,8 @@ public ApiResponse<FeedResponseDTO.FeedResultDTO> 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<Long> deleteFeed(@PathVariable(name = "feedId") Long feedId) {
return ApiResponse.onSuccess(feedService.deleteFeed(feedId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public interface FeedService {

Feed modifyFeed(FeedRequestDTO.ModifyFeedDTO request);

void deleteFeed(Long feedId);
Long deleteFeed(Long feedId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 22b7441

Please sign in to comment.