Skip to content

FEAT: 책 정보 조회 API 구현 (목차 제외)#141

Merged
jaehyeon4406 merged 1 commit into
devfrom
feat/135/detail
Feb 9, 2026
Merged

FEAT: 책 정보 조회 API 구현 (목차 제외)#141
jaehyeon4406 merged 1 commit into
devfrom
feat/135/detail

Conversation

@jaehyeon4406
Copy link
Copy Markdown
Collaborator

@jaehyeon4406 jaehyeon4406 commented Feb 9, 2026

Summary by CodeRabbit

  • New Features
    • Added a public REST API endpoint to retrieve detailed book information, including title, description, publisher, ISBN, publication date, thumbnail images, and author details with roles and profiles.
    • Book information endpoint is publicly accessible without authentication.
    • Implemented error handling with meaningful messages for non-existent books.
    • Results are cached for improved performance.

@jaehyeon4406 jaehyeon4406 linked an issue Feb 9, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 9, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR implements a complete book detail retrieval feature by introducing a REST endpoint at GET /api/v1/books/{bookId}. It includes a controller, service layer with interface and implementation, DTOs with converters, a repository query with fetch join, and integration with global exception handling and security configuration.

Changes

Cohort / File(s) Summary
Controller & REST API
booklog/src/main/java/com/example/booklog/domain/library/books/controller/BookController.java
New REST controller with GET /api/v1/books/{bookId} endpoint that retrieves book details via BookQueryService, includes Swagger/OpenAPI annotations, request logging, and 5-minute cache-control header.
Data Transfer Objects
booklog/src/main/java/com/example/booklog/domain/library/books/dto/BookDetailResponse.java
New record-based DTOs: BookDetailResponse containing book metadata and a nested AuthorInfo record for author details, annotated with Swagger Schema for API documentation.
Data Conversion
booklog/src/main/java/com/example/booklog/domain/library/books/converter/BookConverter.java
Spring component that converts Books entity to BookDetailResponse, including transformation of BookAuthors to AuthorInfo list via stream operations.
Repository Layer
booklog/src/main/java/com/example/booklog/domain/library/books/repository/BooksRepository.java
New method findByIdWithAuthors using JPQL LEFT JOIN FETCH to eagerly load book with associated authors and author details, reducing N+1 query issues.
Service Layer
booklog/src/main/java/com/example/booklog/domain/library/books/service/BookQueryService.java, BookQueryServiceImpl.java
Service interface and implementation for book detail retrieval; implementation includes repository lookup, entity conversion, logging, and EntityNotFoundException throwing.
Global Infrastructure
booklog/src/main/java/com/example/booklog/global/common/apiPayload/handler/GlobalExceptionHandler.java
Added exception handler for EntityNotFoundException that logs errors and returns HTTP 404 with failure ApiResponse.
Security Configuration
booklog/src/main/java/com/example/booklog/global/config/SecurityConfig.java
Added "/api/v1/books/\\" to public allow-URI list for unauthenticated access to book endpoints.

Sequence Diagram

sequenceDiagram
    participant Client
    participant BookController
    participant BookQueryService
    participant BooksRepository
    participant Database
    participant BookConverter

    Client->>BookController: GET /api/v1/books/{bookId}
    BookController->>BookController: Log request
    BookController->>BookQueryService: getBookDetail(bookId)
    BookQueryService->>BookQueryService: Log lookup start
    BookQueryService->>BooksRepository: findByIdWithAuthors(bookId)
    BooksRepository->>Database: Query with fetch join
    Database-->>BooksRepository: Books entity with authors
    BooksRepository-->>BookQueryService: Optional<Books>
    BookQueryService->>BookConverter: toBookDetailResponse(books)
    BookConverter-->>BookQueryService: BookDetailResponse
    BookQueryService->>BookQueryService: Log completion
    BookQueryService-->>BookController: BookDetailResponse
    BookController->>BookController: Set cache-control header
    BookController-->>Client: ResponseEntity 200 OK
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • ktg3891
  • icarus0616
  • millkk04

Poem

🐰 A hop through books, now just a click away,
Detail by detail, the service paves the way,
Controllers dancing with queries so keen,
The finest book API you've ever seen! 📚✨

✨ 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 feat/135/detail

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.

@jaehyeon4406 jaehyeon4406 merged commit fe26253 into dev Feb 9, 2026
1 check was pending
@icarus0616 icarus0616 self-assigned this Feb 9, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Feb 10, 2026
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] 책 상세 정보 조회 API 구현

2 participants