Skip to content

fix: 기록 목록 조회 DTO 변경사항 반영#137

Merged
seoyoon513 merged 2 commits intodevelopfrom
BOOK-252-fix/#136
Aug 10, 2025
Merged

fix: 기록 목록 조회 DTO 변경사항 반영#137
seoyoon513 merged 2 commits intodevelopfrom
BOOK-252-fix/#136

Conversation

@seoyoon513
Copy link
Copy Markdown
Contributor

@seoyoon513 seoyoon513 commented Aug 10, 2025

🔗 관련 이슈

📙 작업 설명

  • 기록 목록 조회 DTO 변경사항 반영
  • initialLoad를 coroutineScope로 변경하여 예외 전파 보장

🧪 테스트 내역

  • 주요 기능 정상 동작 확인
  • 브라우저/기기에서 동작 확인
  • 엣지 케이스 테스트 완료
  • 기존 기능 영향 없음

💬 추가 설명 or 리뷰 포인트

  • 이전에 코드리뷰로 문의해주셨던 정의했던 scope 쓰면 되는데 coroutineScope를 쓰는 이유에 대해서 답변을 못달았었네요
  • 일단 제가 의도한 방향은 '총 3개의 API 중 한 개만 실패해도 UI를 보여주지 않는다'였습니다. 각 영역에 대한 에러 UI 정의가 안되어있기 때문에 성공한 뷰만 보여주는 것은 의미가 없다고 생각했습니다.
  • 따라서 한 개만 실패해도 -> 모두 실패로 처리하기 위해서는 예외가 전파되어야하는데, scope.launch로 감쌀 경우 바깥 try-catch로 전파되지 않아 이번처럼 앱이 죽게됩니다
  • coroutineScope로 감싸서 suspend 함수로 만들 경우 예외가 coroutineScope 호출자에게 던져집니다

Summary by CodeRabbit

  • 신규 기능

    • 독서 기록에 저자 정보가 추가되어 각 기록에서 저자를 확인할 수 있습니다.
  • 기능 개선

    • 독서 기록 목록의 페이지네이션 정보가 명확하게 표시됩니다(마지막 페이지 여부, 전체 결과 수, 시작 인덱스, 페이지당 항목 수 등).
    • 독서 기록 헤더에서 페이지 정보 대신 총 기록 수가 직접 표시됩니다.
  • UI 변경

    • 독서 기록 관련 UI가 총 기록 수를 기반으로 정보를 표시하도록 개선되었습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 10, 2025

Walkthrough

기록 목록 조회와 관련된 DTO, 모델, UI 상태, 프레젠터, 컴포저블 함수 전반에 걸쳐 데이터 구조가 변경되었습니다. 기존의 content, page 기반 구조가 lastPage, totalResults, startIndex, itemsPerPage, readingRecords 등 명확한 필드로 대체되었고, author 필드가 추가되었습니다.

Changes

Cohort / File(s) Change Summary
DTO 및 네트워크 응답 구조 변경
core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt
ReadingRecordsResponseReadingRecord 데이터 클래스 구조를 pagination 명시적 필드와 author 필드 포함하도록 수정
도메인 모델 구조 변경
core/model/src/main/kotlin/com/ninecraft/booket/core/model/ReadingRecordsModel.kt
ReadingRecordsModelReadingRecordModel 구조를 pagination 필드 및 author 필드 포함하도록 변경
매핑 로직 수정
core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt
응답 → 모델 매핑 함수가 새로운 DTO/모델 구조에 맞게 필드 매핑 방식 변경 및 author 필드 추가
프레젠터 및 UI 상태 변경
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt,
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUiState.kt
pageInfo 기반 상태 및 로직을 totalCount 기반으로 변경, 관련 함수 및 상태 필드 수정
컴포저블 및 UI 파라미터 변경
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/component/ReadingRecordsHeader.kt,
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUi.kt
ReadingRecordsHeader의 파라미터를 PageInfoModel에서 totalCount(Int)로 변경, 관련 UI 로직 수정

Sequence Diagram(s)

sequenceDiagram
    participant Network as 네트워크
    participant Mapper as 매퍼
    participant Presenter as 프레젠터
    participant UI as UI

    Network->>Mapper: ReadingRecordsResponse(lastPage, totalResults, ... , readingRecords)
    Mapper->>Presenter: ReadingRecordsModel(lastPage, totalResults, ... , readingRecords)
    Presenter->>UI: BookDetailUiState(readingRecordsTotalCount, readingRecords)
    UI->>UI: ReadingRecordsHeader(totalCount)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
기록 목록 조회 DTO 수정 (#136)

Assessment against linked issues: Out-of-scope changes

(해당 변경사항 내에서는 명확히 범위를 벗어난 기능적 코드 변경이 발견되지 않았습니다.)

Poem

🐰
기록의 DTO가 새 옷을 입었네,
author가 추가되어 책 향기가 퍼지네!
페이지 정보도 한눈에 쏙,
총 개수로 헤더가 더욱 똑똑.
깔끔해진 코드에 토끼도 방긋,
리뷰어도 신나게 hop, hop, hop!

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BOOK-252-fix/#136

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot requested a review from easyhooon August 10, 2025 13:30
@github-actions github-actions Bot added the 🐞 fix Something isn't working label Aug 10, 2025
Copy link
Copy Markdown
Contributor

@easyhooon easyhooon left a comment

Choose a reason for hiding this comment

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

오호 그런 깊은 뜻이 코드 이후에도 계속 봐바야겠네요

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: 0

🧹 Nitpick comments (4)
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/component/ReadingRecordsHeader.kt (1)

24-45: 파라미터 단순화 OK. 숫자 표기는 로케일 포맷 적용 권장

표시되는 개수에 천단위 구분을 적용하면 가독성이 개선됩니다.

아래처럼 NumberFormat을 사용해 포맷팅을 적용해보세요.

-            Text(
-                text = "$totalCount",
+            Text(
+                text = java.text.NumberFormat.getInstance().format(totalCount),
                 color = ReedTheme.colors.contentBrand,
                 style = ReedTheme.typography.headline2SemiBold,
             )
core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt (1)

8-18: 필드 non-null 강제에 따른 디코딩 실패 리스크 확인 필요

네트워크 DTO(ReadingRecordsResponse, ReadingRecord)의 모든 필드를 non-null로 선언하면, 백엔드 응답에서 일부 필드를 누락했을 때 즉시 디코딩 예외가 발생합니다. 계약이 100% 보장되는지 백엔드팀에 확인하거나, 기본값(default value) 설정을 검토해 주세요.

점검 대상 위치

  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt (Lines 8–18)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt ReadingRecord.author (Lines 44–45)

기본값 적용 예시 (선택):

-    @SerialName("author")
-    val author: String,
+    @SerialName("author")
+    val author: String = "",
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt (2)

79-109: initialLoad를 suspend + coroutineScope로 변경한 점 매우 적절

  • 세 API를 async 병렬 실행하고, 하나라도 실패 시 예외를 전파하여 Error UI로 전환됩니다. PR 목적과 완전 일치합니다.
  • 현재 구현으로도 명확하지만, 가독성을 위해 awaitAll을 고려할 수 있습니다(선택).

가능한 소소한 리팩터(선택):

  • val detail = async { ... }, val seeds = async { ... }, val records = async { ... }await는 유지(가독성 OK) 또는 awaitAll로 한 번에 대기(반환형 분기 필요).

173-176: 매개변수 네이밍 정합성(선택 리네임 제안)

  • loadMoreReadingRecords(startIndex: Int)에서 page 파라미터로 그대로 전달됩니다. 실제 의미는 "페이지 인덱스"이므로 startIndexpageIndex 또는 page로의 네이밍 일관성 개선을 제안드립니다.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91462f8 and c9bc82c.

📒 Files selected for processing (7)
  • core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt (2 hunks)
  • core/model/src/main/kotlin/com/ninecraft/booket/core/model/ReadingRecordsModel.kt (2 hunks)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt (2 hunks)
  • feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt (6 hunks)
  • feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUi.kt (1 hunks)
  • feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUiState.kt (1 hunks)
  • feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/component/ReadingRecordsHeader.kt (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: seoyoon513
PR: YAPP-Github/Reed-Android#46
File: feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/component/InfiniteLazyColumn.kt:83-95
Timestamp: 2025-07-14T00:46:03.843Z
Learning: seoyoon513과 팀은 한국어 주석을 선호하며, 한국어 주석을 영어로 번역하라는 제안을 하지 않아야 함
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci-build
🔇 Additional comments (9)
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUi.kt (1)

225-231: DTO 변경 반영 적합 — totalCount 전달로 일관성 확보

ReadingRecordsHeader에 totalCount를 전달하도록 바뀐 점이 상태와 모델 변경사항(페이지 정보 → 전체 개수)과 잘 맞습니다. 이 변경은 UI/Presenter/Model간 데이터 흐름을 단순화합니다.

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUiState.kt (1)

30-33: off-by-one 우려 불필요: 페이지 인덱스 기준(1-based) 일관적 사용
BookDetailPresenter와 BookSearchPresenter 모두 START_INDEX(=1)부터 페이지 번호를 관리하고, loadMore 시 currentStartIndex + 1로 다음 페이지를 요청합니다. 네트워크 응답의 startIndex 필드는 Presenter 로직에 직접 활용되지 않으므로 UI와 도메인 간 기준 불일치로 인한 오프바이원 오류는 발생하지 않습니다.

Likely an incorrect or invalid review comment.

core/model/src/main/kotlin/com/ninecraft/booket/core/model/ReadingRecordsModel.kt (1)

4-9: 모델 구조 리팩터 적합 — 명시적 페이징 메타데이터와 author 필드 추가 OK

content/page 제거 후 명시적 필드와 리스트 이름(readingRecords)로 정리된 점이 명확하고, author 추가도 요구사항에 부합합니다.

Also applies to: 23-24

core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt (2)

194-195: ReadingRecord.author 매핑 추가 LGTM

  • 네트워크 응답/모델에 추가된 author 필드를 정확히 전달하고 있습니다.

173-178: 기존 content/page 기반 참잔조 없음 확인됨
실행된 스크립트를 통해 더 이상 content/page 기반의 구(舊) 구현 참조는 남아있지 않음을 확인했습니다.

  • core/model/src/main/kotlin/.../LibraryModel.kt와 매퍼(ResponseToModel.kt)의 PageInfoModel 참조는 의도된 모델 구조입니다.
  • 네트워크(ReedService.kt) 및 레포지토리(DefaultRecordRepository.kt, RecordRepository.kt) 레이어에서의 page, size 파라미터 사용은 새 페이지네이션 설계에 맞는 정상적인 호출입니다.
feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt (4)

38-38: coroutineScope 도입 LGTM

  • 병렬 호출 실패를 상위로 전파하려는 설계 의도와 일치합니다. import 추가 적절합니다.

102-106: 신규 응답 필드 사용에 따른 상태 업데이트 LGTM

  • records.readingRecords로 리스트 교체, totalResults, lastPage로 카운트/마지막 페이지 플래그 반영이 정확합니다.

68-68: 총 개수 타입 일치 확인 완료 (Int)
ReadingRecordsResponse.totalResultsReadingRecordsModel.totalResults 모두 Int로 선언되어 있어, readingRecordsTotalCount: Int 사용 시 타입 불일치나 오버플로우 우려가 없습니다.


257-257: UI 계층에 readingRecordsPageInfo/PageInfoModel 참조 없음 확인 완료

  • rg 결과 UI 관련 소스에서는 해당 키워드가 검색되지 않았습니다.
  • PageInfoModel 사용은 core/data/impl 및 core/model 모듈에만 존재하며, UI 레이어 변경에는 영향이 없습니다.

@seoyoon513
Copy link
Copy Markdown
Contributor Author

오호 그런 깊은 뜻이 코드 이후에도 계속 봐바야겠네요

그때 제정신으로 작업한게 아니라서..ㅎㅎ 엇 왜죽지? 하다가 발견한거라 제가 설명이 부족했습니다 🙇

@seoyoon513 seoyoon513 merged commit c38f9d4 into develop Aug 10, 2025
5 checks passed
@seoyoon513 seoyoon513 deleted the BOOK-252-fix/#136 branch August 10, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOOK-252/fix] 기록 목록 조회 DTO 수정

2 participants