Skip to content

Conversation

@kmw10693
Copy link
Contributor

@kmw10693 kmw10693 commented Dec 19, 2025

#️⃣ 연관된 이슈

📝작업 내용

공지사항 상세 조회 시 북마크 ID 필드 추가

Summary by CodeRabbit

릴리스 노트

  • 개선 사항

    • 공지 상세 조회 응답에 북마크 ID 정보가 추가되었습니다.
    • 북마크 조회 메커니즘을 최적화했습니다.
  • 테스트

    • 업데이트된 공지 응답 형식에 맞춰 테스트 케이스를 개선했습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@kmw10693 kmw10693 self-assigned this Dec 19, 2025
@github-actions
Copy link

Labeler has applied any labels matching special text in your title and description.
Please review the labels and make any necessary changes.

@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

북마크 조회 로직을 Optional 기반으로 리팩터링하여 북마크 ID를 추적합니다. BookmarkRepository에 새로운 조회 메서드를 추가하고, NoticeService는 이를 활용하여 NoticeDetailResponse에 bookmarkId 필드를 포함하도록 수정되었습니다.

Changes

Cohort / File(s) Summary
Repository 메서드 추가
src/main/java/ku_rum/backend/domain/bookmark/domain/repository/BookmarkRepository.java
findByUserAndNotice(User, Notice) 메서드 추가로 사용자와 공지사항에 해당하는 북마크를 Optional로 반환
DTO 필드 확장
src/main/java/ku_rum/backend/domain/notice/dto/response/NoticeDetailResponse.java
bookmarkId: Long 필드 추가로 북마크 ID를 포함한 응답 구조 변경
서비스 로직 수정
src/main/java/ku_rum/backend/domain/notice/application/NoticeService.java
기존 existsByUserAndNotice 기반의 boolean 체크를 findByUserAndNotice Optional 기반으로 변경하여 bookmarkId와 isBookmarked 플래그 동시 처리
테스트 업데이트
src/test/java/ku_rum/backend/domain/notice/presentation/NoticeControllerTest.java
변경된 NoticeDetailResponse 생성자 서명에 맞추어 Long 파라미터 추가

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 주의 사항: Optional 반환 타입의 올바른 처리 및 null 안전성 확인
  • NoticeDetailResponse 생성자 호출 시 bookmarkId 값의 일관성 검증 (bookmarkId가 -1일 때와 실제 값일 때의 로직)
  • 테스트 케이스에서 모든 북마크 상태 조합(북마크 있음/없음)이 제대로 반영되었는지 확인

Possibly related PRs

  • PR #363: 공지사항 상세 조회 및 NoticeDetailResponse/NoticeService 흐름을 북마크 데이터 포함으로 수정한 것으로, 이번 PR의 선행 작업과 관련
  • PR #328: 동일한 NoticeDetailResponse 타입과 NoticeService.findByNoticeId를 추가 필드로 업데이트하는 공통점
  • PR #320: BookmarkRepository의 북마크 조회 메서드 리팩터링과 직접적 연관

Suggested reviewers

  • david-parkk

Poem

🐰 북마크를 Optional로 담아
선택적 ID를 가져왔네
공지사항 응답이 더 풍요로워
예외 없이 부드럽게 흘러가는
코드의 춤을 추며 ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/notice-bookmarkid

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66c0009 and b644f66.

📒 Files selected for processing (4)
  • src/main/java/ku_rum/backend/domain/bookmark/domain/repository/BookmarkRepository.java (2 hunks)
  • src/main/java/ku_rum/backend/domain/notice/application/NoticeService.java (3 hunks)
  • src/main/java/ku_rum/backend/domain/notice/dto/response/NoticeDetailResponse.java (1 hunks)
  • src/test/java/ku_rum/backend/domain/notice/presentation/NoticeControllerTest.java (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kmw10693 kmw10693 merged commit d3229df into develop Dec 19, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants