-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 내 서재에 기록 수 컬럼 추가 #74
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
Changes from all commits
59ae332
052f686
04bb92e
3387a7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,4 +36,6 @@ interface UserBookRepository { | |||||||
| limit: Int, | ||||||||
| excludeIds: Set<UUID> | ||||||||
| ): List<UserBook> | ||||||||
|
|
||||||||
|
|
||||||||
|
Comment on lines
+39
to
+40
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. 🧹 Nitpick (assertive) 불필요한 빈 줄 제거 인터페이스 끝에 추가된 빈 줄들이 불필요합니다. 코드 일관성을 위해 제거하는 것을 권장합니다. -
-
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| } | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,10 @@ class UserBookEntity( | |
| var status: BookStatus = status | ||
| protected set | ||
|
|
||
| @Column(name = "reading_record_count", nullable = false) | ||
| var readingRecordCount: Int = 0 | ||
| protected set | ||
|
|
||
| fun toDomain(): UserBook = UserBook.reconstruct( | ||
| id = UserBook.Id.newInstance(this.id), | ||
| userId = UserBook.UserId.newInstance(this.userId), | ||
|
|
@@ -76,6 +80,7 @@ class UserBookEntity( | |
| title = this.title, | ||
| author = this.author, | ||
| status = this.status, | ||
| readingRecordCount = this.readingRecordCount, | ||
| createdAt = this.createdAt, | ||
| updatedAt = this.updatedAt, | ||
| deletedAt = this.deletedAt | ||
|
|
@@ -93,7 +98,9 @@ class UserBookEntity( | |
| title = userBook.title, | ||
| author = userBook.author, | ||
| status = userBook.status, | ||
| ) | ||
| ).apply { | ||
| this.readingRecordCount = userBook.readingRecordCount | ||
| } | ||
|
Comment on lines
+101
to
+103
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. 💡 Verification agent 🧩 Analysis chain도메인에서 엔티티로의 변환 로직 검증 필요 readingRecordCount가 apply 블록에서 설정되는 방식은 올바르지만, 이 카운트의 일관성 유지 방법을 확인해야 합니다. PR 목표에 따르면 현재는 읽기 기록 추가 시에만 증가하며, 향후 비즈니스 로직 검토가 필요하다고 명시되어 있습니다. 다음 사항들을 확인해 주세요:
🏁 Script executed: #!/bin/bash
# 읽기 기록 관련 increment/decrement 로직 확인
ast-grep --pattern 'incrementReadingRecordCount($_)'
ast-grep --pattern 'decrementReadingRecordCount($_)'
# ReadingRecord 삭제 관련 로직 확인
rg -A 5 "delete.*ReadingRecord"Length of output: 143 🏁 Script executed: #!/bin/bash
# infra/src 및 도메인 계층 전반에서 readingRecordCount 키워드 검색
rg -n "readingRecordCount"
# 증감 메서드 명 확인
rg -n "incrementReadingRecordCount"
rg -n "decrementReadingRecordCount"
# 읽기 기록 추가/삭제 메서드 확인
rg -n "addReadingRecord"
rg -n "removeReadingRecord"
# DB 삭제 쿼리나 리포지토리 삭제 메서드 검색
rg -n "delete.*ReadingRecord"Length of output: 1675 ReadingRecordCount 동기화 로직 보완 필요
• 삭제 시 감소 구현 부재
• 기존 데이터 초기화 방안 미확인
• 불일치 복구 전략 부재
위 항목들을 반영하여 다음을 진행해주세요.
🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ import java.util.* | |
|
|
||
| @Repository | ||
| class UserBookRepositoryImpl( | ||
| private val jpaUserBookRepository: JpaUserBookRepository, | ||
| private val jpaUserBookRepository: JpaUserBookRepository | ||
| ) : UserBookRepository { | ||
|
|
||
| override fun findByUserIdAndBookIsbn(userId: UUID, isbn: String): UserBook? { | ||
|
|
@@ -81,4 +81,6 @@ class UserBookRepositoryImpl( | |
| val entities = jpaUserBookRepository.findUnrecordedBooksSortedByPriority(userId, excludeIds, limit) | ||
| return entities.map { it.toDomain() } | ||
| } | ||
|
|
||
|
|
||
|
Comment on lines
+84
to
+85
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. 🧹 Nitpick (assertive) 불필요한 빈 줄 제거 클래스 끝에 추가된 빈 줄들이 불필요합니다. 코드 일관성을 위해 제거하는 것을 권장합니다. -
}
🤖 Prompt for AI Agents |
||
| } | ||
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)
성능 최적화 고려사항
createReadingRecord메서드에서 이미 UserBook을 조회했으므로,ReadingRecordInfoVO.newInstance호출 시 재조회하는 대신 이미 가져온userBook객체를 직접 사용하는 것이 더 효율적일 수 있습니다.현재는
buildReadingRecordInfoVO메서드 내부에서 UserBook을 다시 조회하고 있습니다. 다음과 같이 리팩터링을 고려해보세요:return ReadingRecordInfoVO.newInstance( readingRecord = savedReadingRecord, emotionTags = tags.map { it.name }, - bookTitle = userBook.title, - bookPublisher = userBook.publisher, - bookCoverImageUrl = userBook.coverImageUrl, - author = userBook.author + bookTitle = userBook.title, + bookPublisher = userBook.publisher, + bookCoverImageUrl = userBook.coverImageUrl, + author = userBook.author )또는
buildReadingRecordInfoVO메서드를 오버로드하여 이미 조회된 UserBook을 받도록 수정할 수 있습니다.🤖 Prompt for AI Agents