-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 도서 검색 결과에 사용자 읽음 상태 표시 기능 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b4504ee
[BOOK-139] feat: apis,domain,infra - 도서 검색 결과에 사용자 읽음 상태 표시 기능 (#38)
minwoo1999 6f2a545
[BOOK-139] feat: gateway - security cors 추가 (#38)
minwoo1999 0c1b5dd
[BOOK-139] chore: apis - 불필요한 import 제거 (#39)
minwoo1999 a3da273
[BOOK-139] refactor: domain - with함수로 this 간소화 (#39)
minwoo1999 ed9bbea
Merge branch 'develop' into BOOK-139-feature/#38
minwoo1999 2494c0a
[BOOK-139] fix: apis,domain conflict resolve (#38)
minwoo1999 d557cdc
[BOOK-139] refactor: apis - 리뷰 1차 반영 (#38)
minwoo1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
apis/src/main/kotlin/org/yapp/apis/auth/dto/request/UserBooksByIsbnsRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package org.yapp.apis.auth.dto.request | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema | ||
| import jakarta.validation.constraints.NotBlank | ||
| import jakarta.validation.constraints.NotEmpty | ||
| import java.util.UUID | ||
|
|
||
| @Schema( | ||
| name = "UserBooksByIsbnsRequest", | ||
| description = "Request DTO for finding user books by user ID and a list of ISBNs" | ||
| ) | ||
| data class UserBooksByIsbnsRequest( | ||
| @Schema( | ||
| description = "사용자 ID", | ||
| example = "1" | ||
| ) | ||
| @field:NotBlank(message = "userId는 필수입니다.") | ||
| val userId: UUID? = null, | ||
|
|
||
| @Schema( | ||
| description = "도서 ISBN 목록", | ||
| example = "[\"9788966262429\", \"9791190412351\"]" | ||
| ) | ||
| @field:NotEmpty(message = "isbns는 비어있을 수 없습니다.") | ||
| val isbns: List<String>? = null | ||
|
|
||
| ) { | ||
|
|
||
|
|
||
| fun validUserId(): UUID = userId!! | ||
| fun validIsbns(): List<String> = isbns!! | ||
|
|
||
| companion object { | ||
| fun of(userId: UUID, isbns: List<String>): UserBooksByIsbnsRequest { | ||
| return UserBooksByIsbnsRequest(userId = userId, isbns = isbns) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package org.yapp.apis.book.usecase | |
|
|
||
| import org.springframework.beans.factory.annotation.Qualifier | ||
| import org.springframework.transaction.annotation.Transactional | ||
| import org.yapp.apis.auth.dto.request.UserBooksByIsbnsRequest | ||
| import org.yapp.apis.auth.service.UserAuthService | ||
| import org.yapp.apis.book.dto.request.BookCreateRequest | ||
| import org.yapp.apis.book.dto.request.BookDetailRequest | ||
|
|
@@ -29,8 +30,20 @@ class BookUseCase( | |
| private val userBookService: UserBookService, | ||
| private val bookManagementService: BookManagementService | ||
| ) { | ||
| fun searchBooks(request: BookSearchRequest): BookSearchResponse { | ||
| return bookQueryService.searchBooks(request) | ||
| fun searchBooks(request: BookSearchRequest, userId: UUID): BookSearchResponse { | ||
| userAuthService.validateUserExists(userId) | ||
|
|
||
| val searchResponse = bookQueryService.searchBooks(request) | ||
| val isbns = searchResponse.books.map { it.isbn } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (사소) 요거 requestDTO로 포장해서 findAllByUserIdAndBookIsbnIn 메서드의 인자로 넘기면 좋을 것 같긴 합니다! (하지만 중요한 부분은 아닙니다 ㅎㅎ) |
||
|
|
||
| val userBooksReponse = userBookService.findAllByUserIdAndBookIsbnIn(UserBooksByIsbnsRequest.of(userId, isbns)) | ||
| val statusMap = userBooksReponse.associateBy({ it.bookIsbn }, { it.status }) | ||
| searchResponse.books.forEach { bookSummary -> | ||
| statusMap[bookSummary.isbn]?.let { status -> | ||
| bookSummary.updateStatus(status) | ||
| } | ||
| } | ||
| return searchResponse | ||
| } | ||
|
|
||
| fun getBookDetail(bookDetailRequest: BookDetailRequest): BookDetailResponse { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
getBookDetail 메서드의 userId 파라미터 필요성 검토
인터페이스에서
userId파라미터를 추가했지만, 구현체에서는 실제로 사용하지 않습니다. 도서 상세 조회에서 사용자별 상태 정보가 필요한지 검토하고, 필요하지 않다면 이 파라미터를 제거하는 것을 고려해보세요.🤖 Prompt for AI Agents
💡 Verification agent
🧩 Analysis chain
getBookDetail 메소드의 userId 파라미터 필요성을 확인해주세요.
인터페이스에서 userId 파라미터가 추가되었지만, 실제 구현체(BookController.kt)에서는 이 파라미터를 사용하지 않고 있습니다. 만약 도서 상세 조회에서 사용자별 상태 정보가 필요하지 않다면, 인터페이스에서도 이 파라미터를 제거하는 것이 좋겠습니다.
일관성을 위해 다음 중 하나를 선택해야 합니다:
다음 스크립트로 BookUseCase의 getBookDetail 메소드 구현을 확인해보세요:
🏁 Script executed:
Length of output: 55
BookUseCase 인터페이스 및 구현체에서
getBookDetail메서드 정의를 전체적으로 찾아보려면 아래 스크립트를 실행해 주세요.🏁 Script executed:
Length of output: 1131
getBookDetail에서 사용되지 않는 userId 파라미터 제거
현재 API 인터페이스와 컨트롤러 구현에만 존재하는
@AuthenticationPrincipal userId: UUID파라미터는 실제 로직(BookUseCase → BookQueryService)에서 전혀 사용되지 않으므로, 일관성을 위해 제거해 주세요.• apis/src/main/kotlin/org/yapp/apis/book/controller/BookControllerApi.kt (76–79행)
• apis/src/main/kotlin/org/yapp/apis/book/controller/BookController.kt (37–42행)
예시 diff:
🤖 Prompt for AI Agents