diff --git a/src/main/java/org/winey/server/controller/CommentController.java b/src/main/java/org/winey/server/controller/CommentController.java index e731318..132e2be 100644 --- a/src/main/java/org/winey/server/controller/CommentController.java +++ b/src/main/java/org/winey/server/controller/CommentController.java @@ -39,8 +39,7 @@ public ApiResponse deleteComment( @UserId Long userId, @PathVariable Long commentId ) { - commentService.deleteComment(userId, commentId); - return ApiResponse.success(Success.DELETE_COMMENT_SUCCESS); + return ApiResponse.success(Success.DELETE_COMMENT_SUCCESS,commentService.deleteComment(userId, commentId)); } } diff --git a/src/main/java/org/winey/server/controller/response/comment/DeleteCommentResponseDto.java b/src/main/java/org/winey/server/controller/response/comment/DeleteCommentResponseDto.java new file mode 100644 index 0000000..b352bac --- /dev/null +++ b/src/main/java/org/winey/server/controller/response/comment/DeleteCommentResponseDto.java @@ -0,0 +1,17 @@ +package org.winey.server.controller.response.comment; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class DeleteCommentResponseDto { + Long commentId; + + public static DeleteCommentResponseDto of(Long commentId){ + return new DeleteCommentResponseDto(commentId); + } +} diff --git a/src/main/java/org/winey/server/service/CommentService.java b/src/main/java/org/winey/server/service/CommentService.java index 604ea95..23a1820 100644 --- a/src/main/java/org/winey/server/service/CommentService.java +++ b/src/main/java/org/winey/server/service/CommentService.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.winey.server.controller.response.comment.CommentResponseDto; +import org.winey.server.controller.response.comment.DeleteCommentResponseDto; import org.winey.server.domain.comment.Comment; import org.winey.server.domain.notification.NotiType; import org.winey.server.domain.notification.Notification; @@ -56,7 +57,7 @@ public CommentResponseDto createComment(Long userId, Long feedId, String content } @Transactional - public void deleteComment(Long userId, Long commentId){ + public DeleteCommentResponseDto deleteComment(Long userId, Long commentId){ User user = userRepository.findByUserId(userId) .orElseThrow(()-> new NotFoundException(Error.NOT_FOUND_USER_EXCEPTION, Error.NOT_FOUND_USER_EXCEPTION.getMessage())); Comment wantDeleteComment = commentRepository.findByCommentId(commentId) @@ -75,6 +76,7 @@ public void deleteComment(Long userId, Long commentId){ if (res != 1){ throw new UnprocessableEntityException(Error.UNPROCESSABLE_ENTITY_DELETE_EXCEPTION,Error.UNPROCESSABLE_ENTITY_DELETE_EXCEPTION.getMessage()); } + return DeleteCommentResponseDto.of(commentId); }