Skip to content

[REFACTOR] 서재 검색 결과에 bookId 추가#280

Merged
kjhyeon0620 merged 2 commits into
develop-demofrom
refactor/#279-library-search-bookId
May 27, 2026
Merged

[REFACTOR] 서재 검색 결과에 bookId 추가#280
kjhyeon0620 merged 2 commits into
develop-demofrom
refactor/#279-library-search-bookId

Conversation

@kjhyeon0620

@kjhyeon0620 kjhyeon0620 commented May 27, 2026

Copy link
Copy Markdown
Contributor

📄 작업 내용 요약

  • 검색 결과 DTO에 bookId 필드 추가
  • 서재 검색 결과에 내부 도서 ID 매핑
  • 전체 검색의 서재 보유 여부를 ALADIN 도서 기준으로 판정하도록 수정

📎 Issue 번호


✅ 작업 목록

  • 기능 구현
  • 코드 리뷰 반영
  • 테스트 코드 작성
  • 문서 업데이트

📝 기타 참고사항

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 도서 검색 응답에 도서 식별자 정보 추가 - 서재 내 검색 결과에서 도서를 구분할 수 있도록 개선
  • Bug Fixes

    • 서재 검색 시 특정 소스의 도서만 반환하도록 조회 로직 수정

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kjhyeon0620, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 14 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78448f25-fa26-4aad-87b4-e92056ec8321

📥 Commits

Reviewing files that changed from the base of the PR and between afb0373 and 83dca7f.

📒 Files selected for processing (2)
  • src/main/java/app/nook/library/service/LibraryQueryService.java
  • src/test/java/app/nook/library/service/LibraryServiceTest.java

워크스루

서재 검색 응답에 도서 식별자 bookId를 추가하고, ISBN 조회 쿼리를 Aladin 소스 도서로 제한합니다. DTO 필드 추가 후 변환 로직을 업데이트하고, Repository 메서드를 교체하여 중복 ISBN 문제를 해결합니다.

변경사항

Library Search Result Enhancements

Layer / File(s) Summary
BookSearchDto에 bookId 필드 추가 및 변환 로직 업데이트
src/main/java/app/nook/book/dto/BookResponseDto.java, src/main/java/app/nook/book/converter/BookConverter.java, src/test/java/app/nook/controller/book/BookSearchControllerTest.java
BookSearchDto에 Long 타입의 bookId 필드를 추가하고, BookConverter의 toBookSearchDto 메서드에서 book.getId()를 새 필드에 매핑합니다. 서재 검색에서는 bookId가 포함되고 글로벌 검색에서는 null인 것을 RestDocs 응답 스니펫에 문서화합니다.
LibraryRepository의 ISBN 조회를 Aladin 소스로 제한
src/main/java/app/nook/library/repository/LibraryRepository.java, src/main/java/app/nook/library/service/LibraryQueryService.java, src/test/java/app/nook/library/repository/LibraryRepositoryTest.java, src/test/java/app/nook/library/service/LibraryServiceTest.java
findIsbnsByUserIdAndIsbnIn을 findAladinIsbnsByUserIdAndIsbnIn으로 교체하여 ALADIN 소스 도서만 ISBN을 반환하도록 쿼리를 변경합니다. LibraryQueryService와 관련 테스트들이 새 메서드를 호출하도록 업데이트되며, 사용자 등록 도서가 있을 때 Aladin 도서만 반환되는 것을 검증합니다.

예상 코드 리뷰 난이도

🎯 2 (Simple) | ⏱️ ~12 minutes

관련 가능성 있는 PR

  • UMC-NOOK/Server#210: 메인 PR이 BookSearchControllerTest의 RestDocs responseFieldsresult.books[].bookId를 추가한 변경은, 검색 및 Aladin 테스트·문서 스니펫을 추가한 PR #210과 같은 테스트·문서 계층에서 직접 이어집니다.
  • UMC-NOOK/Server#212: 메인 PR이 BookResponseDto.BookSearchDtotoBookSearchDto 계열의 검색 DTO 구성에 필드를 추가한 반면, 검색 DTO 타입 및 생성·매핑 방식을 함께 리팩터링한 PR #212와는 BookSearchDto 자체 및 그 생성 경로를 공유하므로 코드 레벨에서 직접 연관됩니다.

제안 검토자

  • JiwonLee42

📚 북(Book)을 찾아 서재 속에 담고,
Aladin의 ISBN으로 중복을 피하며,
BookId로 이제 쏙 구분하네.
🐰 토끼가 손뼉 짝짝~ 쳐주니,
검색 결과 이제 깔끔하도다!
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive ALADIN 소스 필터링 추가로 인해 ISBN 조회 로직이 변경되었으나, 이는 서재 검색에서 bookId 기반 식별을 안정적으로 구현하기 위한 관련 변경입니다. ALADIN 필터링 변경이 #279 이슈 범위와의 관계를 명확히 해야 합니다. 검색 결과가 ALADIN 도서만 반환되는 의도된 동작인지 확인이 필요합니다.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 주요 변경사항을 명확하게 요약하고 있습니다. 서재 검색 결과에 bookId를 추가하는 것이 이 PR의 핵심이며, 코드 변경사항과 일치합니다.
Linked Issues check ✅ Passed 연결된 이슈 #279의 요구사항이 충분히 충족되었습니다. BookSearchDto에 bookId 필드가 추가되었고, 서재 검색 변환 로직에서 bookId가 매핑되었습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/#279-library-search-bookId

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.

@JiwonLee42

Copy link
Copy Markdown
Contributor
Overall Project 67.94% -0.03% 🍏
Files changed 66.67% 🍏

File Coverage
LibraryQueryService.java 90.56% 🍏
BookConverter.java 69.78% -2.16%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/java/app/nook/library/service/LibraryQueryService.java (1)

78-80: ⚡ Quick win

빈 ISBN 목록은 조기 반환 처리해 주세요.

검색 결과가 0건일 때도 DB 쿼리를 호출하고 있어, 빈 입력은 바로 Set.of()를 반환하는 편이 더 안전하고 효율적입니다.

♻️ 제안 코드
 public Set<String> getOwnedIsbns(Long userId, List<String> isbns) {
+    if (isbns == null || isbns.isEmpty()) {
+        return Set.of();
+    }
     return libraryRepository.findAladinIsbnsByUserIdAndIsbnIn(userId, isbns);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/app/nook/library/service/LibraryQueryService.java` around lines
78 - 80, The getOwnedIsbns method should early-return for empty or null ISBN
input to avoid unnecessary DB calls: add a null/empty check at the start of
getOwnedIsbns (before calling
libraryRepository.findAladinIsbnsByUserIdAndIsbnIn) and return an immutable
empty set (e.g., Set.of()) when isbns is null or isbns.isEmpty(); otherwise
proceed to call libraryRepository.findAladinIsbnsByUserIdAndIsbnIn(userId,
isbns).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/main/java/app/nook/library/service/LibraryQueryService.java`:
- Around line 78-80: The getOwnedIsbns method should early-return for empty or
null ISBN input to avoid unnecessary DB calls: add a null/empty check at the
start of getOwnedIsbns (before calling
libraryRepository.findAladinIsbnsByUserIdAndIsbnIn) and return an immutable
empty set (e.g., Set.of()) when isbns is null or isbns.isEmpty(); otherwise
proceed to call libraryRepository.findAladinIsbnsByUserIdAndIsbnIn(userId,
isbns).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0aa02aa3-7cc4-4eb3-85da-6d655fb22b2e

📥 Commits

Reviewing files that changed from the base of the PR and between c5cb9f4 and afb0373.

📒 Files selected for processing (7)
  • src/main/java/app/nook/book/converter/BookConverter.java
  • src/main/java/app/nook/book/dto/BookResponseDto.java
  • src/main/java/app/nook/library/repository/LibraryRepository.java
  • src/main/java/app/nook/library/service/LibraryQueryService.java
  • src/test/java/app/nook/controller/book/BookSearchControllerTest.java
  • src/test/java/app/nook/library/repository/LibraryRepositoryTest.java
  • src/test/java/app/nook/library/service/LibraryServiceTest.java

@JiwonLee42

Copy link
Copy Markdown
Contributor
Overall Project 67.96% -0.03% 🍏
Files changed 78.57% 🍏

File Coverage
LibraryQueryService.java 90.67% 🍏
BookConverter.java 69.78% -2.16%

@kjhyeon0620 kjhyeon0620 merged commit a9c88c6 into develop-demo May 27, 2026
5 checks passed
@kjhyeon0620 kjhyeon0620 deleted the refactor/#279-library-search-bookId branch May 27, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] 서재 검색 결과 bookId 식별자 추가

2 participants