-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: 씨앗 카운트를 userBookId 기준으로 집계하도록 리팩토링 #84
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
1635cd6
439dd76
3547066
15851e0
adf9748
a2755e1
5d07339
f6eb0b2
ee473fd
5d007b1
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 |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| package org.yapp.apis.auth.strategy.withdraw | ||
|
|
||
| import jakarta.validation.Valid | ||
| import org.yapp.apis.auth.dto.request.WithdrawStrategyRequest | ||
| import org.yapp.domain.user.ProviderType | ||
|
|
||
| interface WithdrawStrategy { | ||
|
|
||
| fun getProviderType(): ProviderType | ||
|
|
||
| fun withdraw(request: WithdrawStrategyRequest) | ||
| fun withdraw(@Valid request: WithdrawStrategyRequest) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| package org.yapp.apis.book.service | ||
|
|
||
| import jakarta.validation.Valid | ||
| import org.yapp.apis.book.dto.request.BookDetailRequest | ||
| import org.yapp.apis.book.dto.request.BookSearchRequest | ||
| import org.yapp.apis.book.dto.response.BookDetailResponse | ||
| import org.yapp.apis.book.dto.response.BookSearchResponse | ||
|
|
||
| sealed interface BookQueryService { | ||
| fun searchBooks(request: BookSearchRequest): BookSearchResponse | ||
| fun getBookDetail(request: BookDetailRequest): BookDetailResponse | ||
| fun getBookDetail(@Valid request: BookDetailRequest): BookDetailResponse | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,11 +4,10 @@ package org.yapp.apis.book.usecase | |||||||||||||||||||||||||||||||||||
| import org.springframework.beans.factory.annotation.Qualifier | ||||||||||||||||||||||||||||||||||||
| import org.springframework.data.domain.Pageable | ||||||||||||||||||||||||||||||||||||
| import org.springframework.transaction.annotation.Transactional | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.request.UserBooksByIsbn13sRequest | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.request.* | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.BookDetailResponse | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.BookSearchResponse | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.BookSearchResponse.* | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.BookSearchResponse.BookSummary | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.UserBookPageResponse | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
7
to
11
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) 와일드카드(
-import org.yapp.apis.book.dto.request.*
+import org.yapp.apis.book.dto.request.BookCreateRequest
+import org.yapp.apis.book.dto.request.BookDetailRequest
+import org.yapp.apis.book.dto.request.BookSearchRequest
+import org.yapp.apis.book.dto.request.UpsertUserBookRequest
+import org.yapp.apis.book.dto.request.UserBookRegisterRequest
+import org.yapp.apis.book.dto.request.UserBooksByIsbn13sRequest반대로 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.dto.response.UserBookResponse | ||||||||||||||||||||||||||||||||||||
| import org.yapp.apis.book.service.BookManagementService | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,17 +14,13 @@ import org.springframework.data.domain.Sort | |
| import org.springframework.data.web.PageableDefault | ||
| import org.springframework.http.ResponseEntity | ||
| import org.springframework.security.core.annotation.AuthenticationPrincipal | ||
| import org.springframework.web.bind.annotation.GetMapping | ||
| import org.springframework.web.bind.annotation.PathVariable | ||
| import org.springframework.web.bind.annotation.PostMapping | ||
| import org.springframework.web.bind.annotation.RequestBody | ||
| import org.springframework.web.bind.annotation.RequestMapping | ||
| import org.springframework.web.bind.annotation.RequestParam | ||
| import org.springframework.web.bind.annotation.* | ||
|
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) Import 문 개선사항을 확인해주세요. wildcard import로 변경되었는데, 사용하지 않는 annotation들이 많이 import될 가능성이 있습니다. 명시적 import가 더 나을 수 있습니다. 🤖 Prompt for AI Agents |
||
| import org.yapp.apis.readingrecord.dto.request.CreateReadingRecordRequest | ||
| import org.yapp.apis.readingrecord.dto.response.ReadingRecordResponse | ||
| import org.yapp.apis.readingrecord.dto.response.SeedStatsResponse | ||
| import org.yapp.domain.readingrecord.ReadingRecordSortType | ||
| import org.yapp.globalutils.exception.ErrorResponse | ||
| import java.util.UUID | ||
| import java.util.* | ||
|
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) Import 문 일관성 확인 java.util.* wildcard import로 변경되었는데, UUID만 사용한다면 명시적 import가 더 적절할 수 있습니다. 🤖 Prompt for AI Agents |
||
|
|
||
| @Tag(name = "Reading Records", description = "독서 기록 관련 API") | ||
| @RequestMapping("/api/v1/reading-records") | ||
|
|
@@ -110,4 +106,28 @@ interface ReadingRecordControllerApi { | |
| @PageableDefault(size = 10, sort = ["createdAt"], direction = Sort.Direction.DESC) | ||
| @Parameter(description = "페이지네이션 정보 (페이지 번호, 페이지 크기, 정렬 방식)") pageable: Pageable | ||
| ): ResponseEntity<Page<ReadingRecordResponse>> | ||
|
|
||
| @Operation( | ||
| summary = "씨앗 통계 조회", | ||
| description = "사용자가 등록한 책에 기록된 씨앗 개수를 조회합니다." | ||
| ) | ||
| @ApiResponses( | ||
| value = [ | ||
| ApiResponse( | ||
| responseCode = "200", | ||
| description = "씨앗 통계 조회 성공", | ||
| content = [Content(schema = Schema(implementation = SeedStatsResponse::class))] | ||
| ), | ||
| ApiResponse( | ||
| responseCode = "404", | ||
| description = "사용자를 찾을 수 없음", | ||
| content = [Content(schema = Schema(implementation = ErrorResponse::class))] | ||
| ) | ||
| ] | ||
| ) | ||
| @GetMapping("/{userBookId}/seed/stats") | ||
| fun getReadingRecordSeedStats( | ||
| @AuthenticationPrincipal userId: UUID, | ||
| @PathVariable userBookId: UUID | ||
| ): ResponseEntity<SeedStatsResponse> | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,22 @@ | ||
| package org.yapp.apis.seed.service | ||
| package org.yapp.apis.readingrecord.service | ||
|
|
||
| import org.springframework.stereotype.Service | ||
| import org.yapp.apis.seed.dto.response.SeedStatsResponse | ||
| import org.yapp.apis.readingrecord.dto.response.SeedStatsResponse | ||
| import org.yapp.domain.readingrecordtag.ReadingRecordTagDomainService | ||
| import org.yapp.globalutils.tag.GeneralEmotionTagCategory | ||
| import java.util.* | ||
|
|
||
| @Service | ||
| class SeedService( | ||
| class ReadingRecordTagService( | ||
| private val readingRecordTagDomainService: ReadingRecordTagDomainService | ||
| ) { | ||
| fun getSeedStatsByUserId(userId: UUID): SeedStatsResponse { | ||
| val tagStatsVO = readingRecordTagDomainService.countTagsByUserIdAndCategories( | ||
| fun getSeedStatsByUserIdAndUserBookId(userId: UUID, userBookId: UUID): SeedStatsResponse { | ||
| val tagStatsVO = readingRecordTagDomainService.countTagsByUserIdAndUserBookIdAndCategories( | ||
| userId = userId, | ||
| userBookId = userBookId, | ||
| categories = GeneralEmotionTagCategory.entries.map { it.displayName } | ||
| ) | ||
|
|
||
| return SeedStatsResponse.from(tagStatsVO) | ||
| } | ||
| } | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ package org.yapp.infra.readingrecordtag.repository | |||||||
|
|
||||||||
| import org.springframework.data.jpa.repository.JpaRepository | ||||||||
| import org.yapp.infra.readingrecordtag.entity.ReadingRecordTagEntity | ||||||||
| import java.util.UUID | ||||||||
| import java.util.* | ||||||||
|
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) 와일드카드 임포트보다는 명시적 임포트 사용을 권장합니다.
-import java.util.*
+import java.util.UUID📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| interface JpaReadingRecordTagRepository : JpaRepository<ReadingRecordTagEntity, UUID>, JpaReadingRecordTagQuerydslRepository { | ||||||||
| fun findByReadingRecordId(readingRecordId: UUID): List<ReadingRecordTagEntity> | ||||||||
|
|
||||||||
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)
일관성을 위한 검토 제안
searchBooks메서드에도 동일한 검증 패턴을 적용하는 것을 고려해보시기 바랍니다. 현재getBookDetail에만@Valid어노테이션이 적용되어 있어 일관성 측면에서 검토가 필요할 수 있습니다.🤖 Prompt for AI Agents