Class CommentService
- java.lang.Object
-
- com.restapi.template.api.community.comment.service.CommentService
-
@Service public class CommentService extends java.lang.Object댓글 서비스.- Version:
- 1.0
- Author:
- always0ne
-
-
Field Summary
Fields Modifier and Type Field Description private CommentRepositorycommentRepositoryprivate PostRepositorypostRepositoryprivate UsersRepositoryusersRepository
-
Constructor Summary
Constructors Constructor Description CommentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteComment(java.lang.Long postId, java.lang.Long commentId, java.lang.String requestUserId)댓글 삭제.CommentgetMyComment(java.lang.Long commentId, java.lang.String requestUserId)내 댓글 가져오기.voidsaveComment(java.lang.Long postId, java.lang.String requestUserId, AddCommentRequest addCommentRequest)댓글 입력.voidupdateComment(java.lang.Long postId, java.lang.Long commentId, java.lang.String requestUserId, UpdateCommentRequest updateCommentRequest)댓글 수정.
-
-
-
Field Detail
-
commentRepository
private final CommentRepository commentRepository
-
postRepository
private final PostRepository postRepository
-
usersRepository
private final UsersRepository usersRepository
-
-
Method Detail
-
saveComment
@Transactional public void saveComment(java.lang.Long postId, java.lang.String requestUserId, AddCommentRequest addCommentRequest)댓글 입력.- Parameters:
postId- 게시글 IDrequestUserId- 요청한 사용자 IDaddCommentRequest- 댓글 작성 요청- Throws:
PostNotFoundException- 존재하지 않는 게시글입니다.
-
updateComment
@Transactional public void updateComment(java.lang.Long postId, java.lang.Long commentId, java.lang.String requestUserId, UpdateCommentRequest updateCommentRequest)댓글 수정.- Parameters:
postId- 게시글 IDcommentId- 댓글 IDrequestUserId- 요청한 사용자 IDupdateCommentRequest- 댓글 수정 요청- Throws:
PostNotFoundException- 존재하지 않는 게시글입니다.ThisIsNotYoursException- 수정권한이 없습니다.
-
deleteComment
@Transactional public void deleteComment(java.lang.Long postId, java.lang.Long commentId, java.lang.String requestUserId)댓글 삭제.- Parameters:
postId- 게시글 IDcommentId- 댓글 IDrequestUserId- 요청한 사용자 ID- Throws:
PostNotFoundException- 존재하지 않는 게시글입니다.ThisIsNotYoursException- 수정권한이 없습니다.
-
getMyComment
public Comment getMyComment(java.lang.Long commentId, java.lang.String requestUserId)
내 댓글 가져오기.- Parameters:
commentId- 댓글 IDrequestUserId- 요청한 사용자 ID- Returns:
- 댓글 엔터티
- Throws:
ThisIsNotYoursException- 수정권한이 없습니다.
-
-