-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 감상평 optional 관련 Side effect 작업 #237
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
Conversation
Walkthrough감상평(review/appreciation) 필드를 DTO, 도메인(VO/Entity), ViewModel, View 전반에서 선택사항으로(String → String?) 변경하고, UI와 저장/조회 흐름에서 nil/빈값을 처리하도록 제어 흐름을 조정했습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Note Edit / Completion View
participant VM as NoteEditViewModel
participant DTO as InsertRecordRequest/Response DTOs
participant API as Backend API
rect rgba(200,230,255,0.4)
note right of UI: 저장 요청 (감상평 선택사항)
UI->>VM: saveButtonTapped(page, sentence, appreciation?)
VM->>DTO: Create InsertRecordRequestDTO(review: appreciation?)
DTO->>API: POST /records (review may be null)
API-->>DTO: 201 / response (review may be null)
DTO->>VM: toRecordInfo(review: String?)
VM->>UI: update UI with RecordInfo (review nil or value)
end
rect rgba(230,255,220,0.4)
note right of UI: 조회/완료 화면 렌더링
UI->>DTO: fetch record
DTO-->>UI: DetailRecordResponseDTO(review: String?)
UI->>UI: AppreciationResultView.apply(emotion, date, appreciation: String? = "")
note right of UI: if appreciation nil/empty -> hide label & spacing 0
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-08-26T07:08:40.739ZApplied to files:
🔇 Additional comments (1)
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. Comment |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/Projects/BKPresentation/Sources/MainFlow/Note/ViewModel/NoteForm.swift (1)
31-36: 감상평이 없을 때 NoteForm 생성 실패 문제
appreciation을 optional로 변경했지만, guard 문에서 여전히finalAppreciation을 require하고 있습니다. 이로 인해 감상평이 없는 경우makeNoteForm이 nil을 반환하여 기록 저장이 불가능합니다.다음과 같이 수정하세요:
guard let finalPage = page, let finalSentence = sentence, - let finalEmotion = emotion, - let finalAppreciation = appreciation else { + let finalEmotion = emotion else { return nil } return NoteForm( page: finalPage, sentence: finalSentence, emotion: finalEmotion, - appreciation: finalAppreciation + appreciation: appreciation )src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/View/NoteEditView.swift (1)
273-281: appreciation 타입을 String?로 변경하고 빈 값에 nil 반환
getCurrentFormData()의 반환 타입이 NoteEditViewModel의 expectation과 일치하지 않습니다.발견된 문제:
- View 반환:
appreciation: String(비옵셔널)- ViewModel 예상:
appreciation: String?(옵셔널) — NoteEditViewModel.swift 26번 줄필요한 수정:
func getCurrentFormData() -> (page: Int?, sentence: String, appreciation: String?) { let pageText = pageField.text.trimmingCharacters(in: .whitespacesAndNewlines) let sentenceText = sentenceTextView.text.trimmingCharacters(in: .whitespacesAndNewlines) let appreciationText = appreciationTextView.text.trimmingCharacters(in: .whitespacesAndNewlines) let page = pageText.isEmpty ? nil : Int(pageText) let appreciation = appreciationText.isEmpty ? nil : appreciationText return (page: page, sentence: sentenceText, appreciation: appreciation) }page 필드와 동일하게, 빈 appreciation은 nil로 반환해야 합니다.
🧹 Nitpick comments (3)
src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/View/NoteEditView.swift (1)
252-256: 불필요한 else 블록 제거빈 else 블록은 불필요합니다. optional binding만으로 충분합니다.
다음과 같이 간소화하세요:
- -if let review = recordInfo.review { +if let review = recordInfo.review { appreciationTextView.setText(review) -} else { - }src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/NoteCompletionView.swift (1)
46-50: nil-coalescing 대신 optional 직접 전달 고려
recordInfo.review ?? ""로 빈 문자열을 전달하는 대신,AppreciationResultView.apply가 optional을 직접 받도록 하는 것이 더 명확할 수 있습니다. 빈 문자열과 nil을 구분하여 UI를 다르게 렌더링해야 할 수 있습니다.
AppreciationResultView.apply의 시그니처를 확인하고, appreciation 파라미터가 optional을 받을 수 있다면 다음과 같이 수정을 고려하세요:appreciationResultView.apply( emotion: EmotionIcon.from(emotion: recordInfo.emotionTags.first ?? .joy), creationDate: recordInfo.createdAt, - appreciation: recordInfo.review ?? "" + appreciation: recordInfo.review )src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/AppreciationResultView.swift (1)
142-142: 기본 파라미터 값이 혼란스러울 수 있습니다.옵셔널 타입에 빈 문자열(
"")을 기본값으로 설정하는 것은 API 의도를 불명확하게 만듭니다. 호출자가 명시적으로nil또는 실제 값을 전달하도록 기본값을 제거하는 것을 권장합니다.func apply( emotion: EmotionIcon, creationDate: Date, - appreciation: String? = "" + appreciation: String? ) {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/Projects/BKData/Sources/DTO/Request/InsertRecordRequestDTO.swift(1 hunks)src/Projects/BKData/Sources/DTO/Response/DetailRecordResponseDTO.swift(1 hunks)src/Projects/BKData/Sources/DTO/Response/InsertRecordResponseDTO.swift(1 hunks)src/Projects/BKDomain/Sources/Entity/RecordInfo.swift(2 hunks)src/Projects/BKDomain/Sources/VO/RecordDetails/RecordVO.swift(1 hunks)src/Projects/BKPresentation/Sources/MainFlow/Note/ViewModel/NoteForm.swift(1 hunks)src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/AppreciationResultView.swift(2 hunks)src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/NoteCompletionView.swift(1 hunks)src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/View/NoteEditView.swift(1 hunks)src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/ViewModel/NoteEditViewModel.swift(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/ViewModel/NoteEditViewModel.swift (1)
src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/View/NoteEditView.swift (1)
saveButtonTapped(130-132)
src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/AppreciationResultView.swift (1)
src/Projects/BKPresentation/Sources/Common/Extension/Date+.swift (1)
toKoreanDateString(14-16)
⏰ 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: build
🔇 Additional comments (7)
src/Projects/BKData/Sources/DTO/Response/InsertRecordResponseDTO.swift (1)
11-11: LGTM!
review필드를 optional로 변경한 것이 적절합니다. Decodable 프로토콜은 자동으로 nil 값을 처리합니다.src/Projects/BKDomain/Sources/VO/RecordDetails/RecordVO.swift (1)
8-8: LGTM!
RecordVO의review필드와 이니셜라이저 파라미터를 optional로 일관되게 변경했습니다.Also applies to: 14-14
src/Projects/BKDomain/Sources/Entity/RecordInfo.swift (1)
10-10: LGTM!도메인 엔티티의
review필드를 optional로 변경한 것이 적절합니다.Decodable과Equatable프로토콜 모두 optional 값을 올바르게 처리합니다.Also applies to: 24-24
src/Projects/BKPresentation/Sources/MainFlow/NoteEdit/ViewModel/NoteEditViewModel.swift (1)
95-110: 감상평 optional 처리 로직 확인ViewModel에서
appreciation을 optional로 처리하는 것은 올바르지만,NoteForm생성 로직이 이를 올바르게 처리하는지 확인해야 합니다.NoteForm.makeNoteForm에서 appreciation이 nil일 때도 성공적으로 생성되어야 합니다.
NoteForm.swift의makeNoteForm메서드에서 guard 문이 optional appreciation을 올바르게 처리하는지 확인하세요.src/Projects/BKData/Sources/DTO/Response/DetailRecordResponseDTO.swift (1)
11-11: LGTM!응답 DTO의
review필드를 optional로 변경하여 API에서 nil 값을 받을 수 있도록 했습니다.src/Projects/BKData/Sources/DTO/Request/InsertRecordRequestDTO.swift (1)
6-32: 변경사항이 올바르게 적용되었습니다.
review필드를 옵셔널로 변경한 것이 일관성 있게 적용되었습니다. 프로퍼티 선언, 생성자 파라미터, 그리고RecordVO로부터의 초기화 로직이 모두 정확합니다.src/Projects/BKPresentation/Sources/MainFlow/NoteCompletion/View/AppreciationResultView.swift (1)
47-53: lazy var로의 변경이 적절합니다.
rootStack을lazy var로 변경한 것은 spacing과 arranged subviews를 동적으로 변경하기 위해 필요한 수정입니다.
🔗 관련 이슈
📘 작업 유형
📙 작업 내역
🧪 테스트 내역
🎨 스크린샷 또는 시연 영상 (선택)
디테일 레이아웃 디버깅
✅ PR 체크리스트
💬 추가 설명 or 리뷰 포인트 (선택)
Summary by CodeRabbit
릴리스 노트