-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: 기본정렬과 동적정렬 UPDATE시간으로도 가능하도록 수정 , 감상평 Optional #126
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
185623e
13142b0
3b82956
fe70aa2
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 |
|---|---|---|
|
|
@@ -105,8 +105,8 @@ interface ReadingRecordControllerApi { | |
| @AuthenticationPrincipal @Parameter(description = "인증된 사용자 ID") userId: UUID, | ||
| @PathVariable @Parameter(description = "독서 기록을 조회할 사용자 책 ID") userBookId: UUID, | ||
| @RequestParam(required = false) @Parameter(description = "정렬 방식 (PAGE_NUMBER_ASC, PAGE_NUMBER_DESC, CREATED_DATE_ASC, CREATED_DATE_DESC)") sort: ReadingRecordSortType?, | ||
| @PageableDefault(size = 10, sort = ["createdAt"], direction = Sort.Direction.DESC) | ||
| @Parameter(description = "페이지네이션 정보 (페이지 번호, 페이지 크기, 정렬 방식)") pageable: Pageable | ||
| @PageableDefault(size = 10, sort = ["updatedAt"], direction = Sort.Direction.DESC) | ||
| @Parameter(description = "페이지네이션 정보 (기본값: 10개, 최신 수정일 순)") pageable: Pageable | ||
| ): ResponseEntity<ReadingRecordPageResponse> | ||
|
Comment on lines
107
to
110
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 | 🔵 Trivial OpenAPI 예시/문서에 UPDATED_DATE_ 추가 고려* 도메인 정렬 타입에 UPDATED_DATE가 추가되었으므로 문서에도 반영하세요. 🤖 Prompt for AI Agents |
||
|
|
||
| @Operation( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,17 +30,19 @@ data class CreateReadingRecordRequest private constructor( | |
| @field:Schema(description = "기억에 남는 문장", example = "이것은 기억에 남는 문장입니다.", required = true) | ||
| val quote: String? = null, | ||
|
|
||
| @field:NotBlank(message = "감상평은 필수입니다.") | ||
| @field:Size(max = 1000, message = "감상평은 1000자를 초과할 수 없습니다.") | ||
| @field:Schema(description = "감상평", example = "이 책은 매우 인상적이었습니다.", required = true) | ||
| @field:Schema(description = "감상평", example = "이 책은 매우 인상적이었습니다.", required = false) | ||
| val review: String? = null, | ||
|
Comment on lines
33
to
35
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. 🧩 Analysis chainLGTM! 감상평 필드가 선택사항으로 올바르게 변경되었습니다.
다음 스크립트를 실행하여 백엔드 로직이 nullable review를 올바르게 처리하는지 확인하세요: 🏁 Script executed: #!/bin/bash
# Description: CreateReadingRecordRequest를 사용하는 서비스 계층이나 컨트롤러에서
# review 필드를 null로 처리하는지 확인
# Test: CreateReadingRecordRequest를 사용하는 모든 위치 검색
rg -n --type=kt -C 5 "CreateReadingRecordRequest" Length of output: 26 🏁 Script executed: #!/bin/bash
# Search for CreateReadingRecordRequest usages without specifying file type
rg -n "CreateReadingRecordRequest" -A 5 -B 5
# Search for any calls to validReview method
echo "=== Searching for validReview() calls ==="
rg -n "validReview\s*\(" -A 3 -B 3
# Check the current state of the CreateReadingRecordRequest file
echo "=== Current CreateReadingRecordRequest.kt file ==="
fd "CreateReadingRecordRequest.kt" -x cat {}Length of output: 18142 긴급:
수정 방법:
review 필드가 이제 선택사항이므로 force unwrap( 🤖 Prompt for AI Agents |
||
|
|
||
| @field:Size(max = 1, message = "감정 태그는 최대 1개까지 가능합니다. (단일 감정만 받지만, 확장성을 위해 리스트 형태로 관리됩니다.)") | ||
| @field:Schema(description = "감정 태그 목록 (현재는 최대 1개, 확장 가능)", example = "[\"감동적\"]") | ||
| val emotionTags: List<@Size(max = 10, message = "감정 태그는 10자를 초과할 수 없습니다.") String> = emptyList() | ||
| ) { | ||
| fun validPageNumber(): Int = pageNumber!! | ||
| fun validQuote(): String = quote!! | ||
| fun validReview(): String = review!! | ||
| fun validPageNumber(): Int = | ||
| requireNotNull(pageNumber) { "pageNumber는 null일 수 없습니다." } | ||
|
|
||
| fun validQuote(): String = | ||
| requireNotNull(quote) { "quote는 null일 수 없습니다." } | ||
|
|
||
|
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. 🧩 Analysis chainLGTM! validReview() 헬퍼 메서드 제거가 적절합니다. 감상평이 선택사항이 되면서 제거된 🏁 Script executed: #!/bin/bash
# Description: validReview() 메서드 사용처 검색.
# 예상 결과: 사용처가 없어야 함 (있다면 컴파일 에러 발생)
# Test: validReview() 호출 검색
rg -n --type=kt "\.validReview\(\)"Length of output: 26 🏁 Script executed: #!/bin/bash
# Description: validReview() 메서드 사용처 검색 (수정된 버전)
# 방법: glob 패턴으로 .kt 파일만 검색
rg -n --glob="*.kt" "\.validReview\(\)"Length of output: 255 🏁 Script executed: #!/bin/bash
# Description: ReadingRecordService.kt의 validReview() 호출 부분 확인
# 라인 28 주변 코드 보기 (context: 10줄)
echo "=== Line 28 context ==="
rg -n --glob="*.kt" -B5 -A5 "validReview\(\)" apis/src/main/kotlin/org/yapp/apis/readingrecord/service/ReadingRecordService.kt | head -20
echo ""
echo "=== Full view of problematic method ==="
# ReadingRecordService.kt 전체 구조 파악
cat apis/src/main/kotlin/org/yapp/apis/readingrecord/service/ReadingRecordService.ktLength of output: 3998 🏁 Script executed: #!/bin/bash
# Description: ReadingRecordDomainService의 review 파라미터 타입 확인
# ReadingRecordDomainService 찾기
find . -name "ReadingRecordDomainService.kt" -type f 2>/dev/null | head -5
# createReadingRecord, modifyReadingRecord 메서드 시그니처 확인
rg -n --glob="*.kt" -A10 "fun createReadingRecord|fun modifyReadingRecord" | grep -A10 "ReadingRecordDomainService" | head -30Length of output: 3575 🏁 Script executed: #!/bin/bash
# Description: 요청 DTO 파일들에서 review 필드 확인
echo "=== CreateReadingRecordRequest.kt ==="
cat apis/src/main/kotlin/org/yapp/apis/readingrecord/dto/request/CreateReadingRecordRequest.kt
echo ""
echo "=== UpdateReadingRecordRequest.kt ==="
cat apis/src/main/kotlin/org/yapp/apis/readingrecord/dto/request/UpdateReadingRecordRequest.ktLength of output: 3252 apis/src/main/kotlin/org/yapp/apis/readingrecord/service/ReadingRecordService.kt에서 컴파일 에러 수정 필요
추가로, 🤖 Prompt for AI Agents |
||
| fun validEmotionTags(): List<String> = emotionTags | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ALTER TABLE reading_records MODIFY COLUMN review VARCHAR(1000) NULL; |
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.
sort파라미터 충돌 위험 — enum 정렬 vs Pageable 정렬 분리 필요여기도
@RequestParam sort: ReadingRecordSortType?와 Pageable의sort가 충돌합니다.?sort=updatedAt,desc사용 시 enum 바인딩 실패 가능.권장 수정:
서비스/레포에서
sortType반영되도록 함께 조정이 필요합니다.🤖 Prompt for AI Agents