Feat: 댓글 좋아요/좋아요 취소 API 구현 (#181) #200
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📌 개요
🔨 작업 내용
Controller
CommentLikeController추가POST /api/posts/{postId}/comments/{commentId}/like: 댓글 좋아요 등록DELETE /api/posts/{postId}/comments/{commentId}/like: 댓글 좋아요 취소Service
CommentLikeService구현COMMENT_005예외 발생COMMENT_006예외 처리 및likeCount감소 반영Repository
CommentLikeRepository추가existsByUserIdAndCommentId,findByUserIdAndCommentId메서드 구현Entity
Comment엔티티에likeCount필드 추가 (@Column(nullable = false, default = 0))increaseLikeCount(),decreaseLikeCount()메서드 추가DTO
CommentLikeResponse추가 (commentId,likeCount반환)ErrorCode
COMMENT_005: 이미 좋아요한 댓글입니다.COMMENT_006: 좋아요 기록이 없습니다.GlobalExceptionHandler
HttpRequestMethodNotSupportedException,NoHandlerFoundException처리 추가 (400으로 변환)Swagger 문서 (
CommentLikeControllerDocs)🔗 관련 이슈
Closes #181
📝 참고 사항
Comment엔티티에likeCount필드 추가 -> 노션 ERD에 반영해두었습니다.CommentRepositoryImpl에TODO주석 추가: QueryDSL 조회 시likeCount포함 개선 예정.✅ 체크리스트