Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge to main #131

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 3 additions & 1 deletion src/main/java/org/winey/server/service/CommentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}


Expand Down