Feat: 게시글 좋아요/좋아요 취소 API 구현 (#201) #203
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
PostLikeController추가POST /api/posts/{postId}/like: 게시글 좋아요 등록DELETE /api/posts/{postId}/like: 게시글 좋아요 취소Service
PostLikeService구현POST_005예외 발생POST_006예외 처리 및likeCount감소 반영Repository
PostLikeRepository추가existsByUserIdAndPostId,findByUserIdAndPostId메서드 구현Entity
Post엔티티에likeCount필드 추가 (@Column(nullable = false))increaseLikeCount(),decreaseLikeCount()메서드 추가DTO
PostLikeResponse추가 (postId,likeCount반환)ErrorCode
POST_005: 이미 좋아요한 게시글입니다.POST_006: 해당 게시글에 대한 좋아요 기록이 없습니다.Swagger 문서 (
PostLikeControllerDocs)Test
PostLikeServiceTest: 좋아요 등록 및 취소 단위 테스트 작성PostLikeControllerTest: 명세의 모든 케이스(성공, 실패) 통합 테스트 작성🔗 관련 이슈
Closes #201
📝 참고 사항
Post엔티티에likeCount필드 추가됨 → ERD 반영 필요PostRepositoryImpl에TODO주석 추가: QueryDSL 조회 시likeCount포함 개선 예정✅ 체크리스트