Feat: 게시글 북마크/북마크 취소 API 구현 (#210) #211
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.
📌 개요
🔨 작업 내용
1. Controller
PostBookmarkController추가POST /api/posts/{postId}/bookmark: 게시글 북마크 등록DELETE /api/posts/{postId}/bookmark: 게시글 북마크 취소PostBookmarkControllerDocs작성2. Service
PostBookmarkService구현북마크 등록 로직
BOOKMARK_ALREADY_EXISTS예외 발생bookmarkCount증가북마크 취소 로직
BOOKMARK_NOT_FOUND예외 발생bookmarkCount감소3. Repository & Entity
PostBookmarkRepositoryexistsByUserIdAndPostId(Long userId, Long postId)findByUserIdAndPostId(Long userId, Long postId)PostBookmark엔티티 수정(post_id, user_id)복합 Unique 제약 조건 추가@AllArgsConstructor추가4. DTO
PostBookmarkResponsefrom(Post post)제공5. Exception
ErrorCode에 북마크 관련 예외 코드 추가BOOKMARK_ALREADY_EXISTS (POST_007)BOOKMARK_NOT_FOUND (POST_008)6. Test
PostBookmarkServiceTest존재하지 않는 게시글,중복,북마크 없음) 검증PostBookmarkControllerTest🔗 관련 이슈
Closes #210
📝 참고 사항
✅ 체크리스트