Skip to content

[FEAT] 도서 상세 및 서재 액션에 독서 상태 응답 추가#267

Merged
kjhyeon0620 merged 2 commits into
develop-demofrom
feat/#265-library-book-status-response
May 7, 2026
Merged

[FEAT] 도서 상세 및 서재 액션에 독서 상태 응답 추가#267
kjhyeon0620 merged 2 commits into
develop-demofrom
feat/#265-library-book-status-response

Conversation

@kjhyeon0620
Copy link
Copy Markdown
Contributor

@kjhyeon0620 kjhyeon0620 commented May 7, 2026

📄 작업 내용 요약

  • 도서 상세 조회 응답에 readingStatus 추가
  • 서재 등록/삭제/상태 변경 API 응답에 bookId, bookShelfId, readingStatus 추가

📎 Issue 번호


✅ 작업 목록

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

📝 기타 참고사항

Summary by CodeRabbit

Release Notes

  • New Features
    • 서재 도서 관리 작업(등록, 삭제, 독서상태 변경) 시 도서 ID, 책장 ID, 독서상태를 포함한 구조화된 응답 데이터 반환
    • 도서 상세 조회 API에서 사용자의 독서상태 정보 포함
    • 라이브러리 명령 엔드포인트에서 void 응답 대신 실질적인 응답 데이터 제공으로 클라이언트 사용성 향상

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

Warning

Rate limit exceeded

@kjhyeon0620 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 8 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2ebc0cd2-eb34-4cf9-9967-0138e19dde05

📥 Commits

Reviewing files that changed from the base of the PR and between d4d0885 and 47f6371.

📒 Files selected for processing (4)
  • src/main/java/app/nook/library/controller/LibraryController.java
  • src/main/java/app/nook/library/dto/ReadingStatusRequestDto.java
  • src/test/java/app/nook/controller/book/BookControllerTest.java
  • src/test/java/app/nook/controller/library/LibraryControllerTest.java

Walkthrough

이 PR은 도서 상세 조회 응답에 readingStatus 필드를 추가하고, 서재 액션(등록/삭제/상태 변경) API 응답을 기존의 성공/실패 플래그에서 bookId, bookShelfId, readingStatus를 포함하는 새로운 BookStatusResponseDto로 확장합니다.

Changes

도서 상세 및 서재 독서 상태 응답 추가

Layer / File(s) Summary
응답 DTO 및 데이터 계약
src/main/java/app/nook/book/dto/BookResponseDto.java, src/main/java/app/nook/library/dto/LibraryViewDto.java
BookDetailDtoReadingStatus readingStatus 필드를 추가하고, 새로운 BookStatusResponseDto 레코드를 LibraryViewDto에 정의하여 bookId, bookShelfId, readingStatus를 반환합니다.
서비스 비즈니스 로직
src/main/java/app/nook/book/service/BookService.java, src/main/java/app/nook/library/service/LibraryCommandService.java
LibraryCommandServiceregisterBook, deleteByBookId, changeReadingStatus 메서드가 void 대신 BookStatusResponseDto를 반환하도록 변경하고, Library 엔티티로부터 응답을 구성하는 toBookStatusResponse 헬퍼를 추가합니다. BookServicefindLibrary 헬퍼를 통해 Library 엔티티를 직접 조회합니다.
DTO 매핑 및 통합
src/main/java/app/nook/book/converter/BookConverter.java
toBookDetailDto 메서드의 파라미터를 Long bookShelfId에서 Library library로 변경하고, library로부터 bookShelfIdreadingStatus를 null-safe 방식으로 매핑합니다.
컨트롤러 응답 처리
src/main/java/app/nook/library/controller/LibraryController.java
registerBook, deleteBook, changeStatus 엔드포인트가 ApiResponse<Void> 대신 ApiResponse<BookStatusResponseDto>를 반환하고, 서비스로부터 받은 응답 DTO를 SuccessCode.OK와 함께 래핑합니다.
테스트 및 검증
src/test/java/app/nook/book/service/BookServiceTest.java, src/test/java/app/nook/controller/book/BookControllerTest.java, src/test/java/app/nook/controller/library/LibraryControllerTest.java, src/test/java/app/nook/library/service/LibraryServiceTest.java
BookServiceTest, BookControllerTest, LibraryControllerTest, LibraryServiceTest를 업데이트하여 새로운 readingStatus 필드와 BookStatusResponseDto 응답 필드들의 존재 여부 및 값을 검증합니다. REST Docs 스니펫도 선택적 필드 및 타입을 포함하도록 확장됩니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • UMC-NOOK/Server#214: 동일한 BookConverter 및 Library 기반 readingStatus 처리를 변경하며, BookService가 Library/User를 전달하도록 조정합니다.
  • UMC-NOOK/Server#194: 동일한 BookConverter.toBookDetailDto 메서드의 파라미터를 Long bookShelfId에서 Library로 변경하고 readingStatus 처리를 추가합니다.
  • UMC-NOOK/Server#204: 동일한 Library 엔티티, 컨트롤러 엔드포인트, 서비스 로직 및 타임라인 통합을 다루며, 이 PR이 소개된 구현을 바탕으로 합니다.

Poem

🐰 서재의 책들이 목소리를 찾았네요,
독서 상태는 이제 명확하고,
등록, 삭제, 상태 변경은
한 번의 응답으로 모두 알려줍니다—
프론트엔드가 행복해할 날입니다! 📚✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 도서 상세 조회 응답에 독서 상태를 추가하고 서재 액션 응답을 개선하는 주요 변경사항을 명확하게 반영하고 있습니다.
Linked Issues check ✅ Passed PR의 모든 코드 변경사항이 #265 이슈의 요구사항을 충족합니다: 도서 상세 조회에 readingStatus 추가, 서재 액션 응답에 bookId/bookShelfId/readingStatus 포함, 적절한 null 처리 등이 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 #265 이슈의 명시된 목표와 일관되게 관련되어 있으며, 범위를 벗어난 변경사항은 없습니다.

✏️ 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 feat/#265-library-book-status-response

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.18% 🍏
Files changed 100% 🍏

File Coverage
LibraryController.java 100% 🍏
LibraryCommandService.java 94.53% 🍏
BookService.java 76.1% 🍏
BookConverter.java 71.32% 🍏

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@src/main/java/app/nook/library/controller/LibraryController.java`:
- Around line 58-60: The changeStatus handler in LibraryController is missing
request-body validation: add the `@Valid` annotation to the `@RequestBody` parameter
in the changeStatus method signature (public
ApiResponse<LibraryViewDto.BookStatusResponseDto> changeStatus(`@CurrentUser` User
user, `@Valid` `@RequestBody` ReadingStatusRequestDto requestDto)) and ensure
ReadingStatusRequestDto has appropriate validation annotations on its fields;
also import the correct Valid type (javax.validation.Valid or
jakarta.validation.Valid) so Spring triggers 4xx validation errors instead of
propagating invalid input to the service.

In `@src/test/java/app/nook/controller/book/BookControllerTest.java`:
- Line 93: The test currently asserts that the fields are missing
(jsonPath("$.result.readingStatus").doesNotExist()), which contradicts the API
contract that unregistered books should return bookShelfId=null and
readingStatus=null; update BookControllerTest assertions to explicitly expect
null for the JSON paths "$.result.readingStatus" and "$.result.bookShelfId" (and
the other occurrences around lines 112-113) by replacing the doesNotExist checks
with null-value assertions so the test requires the fields to be present with
null values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0f655c09-b472-41f8-8c25-5b57d9a54796

📥 Commits

Reviewing files that changed from the base of the PR and between 4dd7d58 and d4d0885.

📒 Files selected for processing (10)
  • src/main/java/app/nook/book/converter/BookConverter.java
  • src/main/java/app/nook/book/dto/BookResponseDto.java
  • src/main/java/app/nook/book/service/BookService.java
  • src/main/java/app/nook/library/controller/LibraryController.java
  • src/main/java/app/nook/library/dto/LibraryViewDto.java
  • src/main/java/app/nook/library/service/LibraryCommandService.java
  • src/test/java/app/nook/book/service/BookServiceTest.java
  • src/test/java/app/nook/controller/book/BookControllerTest.java
  • src/test/java/app/nook/controller/library/LibraryControllerTest.java
  • src/test/java/app/nook/library/service/LibraryServiceTest.java

Comment thread src/main/java/app/nook/library/controller/LibraryController.java Outdated
Comment thread src/test/java/app/nook/controller/book/BookControllerTest.java Outdated
@JiwonLee42
Copy link
Copy Markdown
Contributor

Overall Project 67.18% 🍏
Files changed 100% 🍏

File Coverage
LibraryController.java 100% 🍏
LibraryCommandService.java 94.53% 🍏
BookService.java 76.1% 🍏
BookConverter.java 71.32% 🍏

@kjhyeon0620 kjhyeon0620 merged commit 9efe641 into develop-demo May 7, 2026
5 checks passed
@kjhyeon0620 kjhyeon0620 deleted the feat/#265-library-book-status-response branch May 8, 2026 18:32
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.

[FEAT] 도서 상세 및 서재 액션 응답에 독서 상태 정보 추가

2 participants