Conversation
Walkthrough이 변경 사항은 추천 루틴을 ID로 단일 조회하는 기능을 전 계층에 걸쳐 추가합니다. 엔드포인트, 리포지토리, 유스케이스, 프로토콜, 뷰모델, DI 조립, 뷰 등에서 관련 메서드와 생성자, DI 주입, 네비게이션 처리가 도입되었습니다. 기존 목록 조회 로직은 그대로 유지됩니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RecommendedRoutineView
participant DIContainer
participant RoutineCreationViewModel
participant RecommendedRoutineUseCase
participant RoutineCreationView
User->>RecommendedRoutineView: 추천 루틴 카드 탭
RecommendedRoutineView->>DIContainer: RoutineCreationViewModel, RecommendedRoutineUseCaseProtocol resolve
RecommendedRoutineView->>RoutineCreationView: 생성자 호출 (recommendRoutineId 전달)
RoutineCreationView->>RoutineCreationViewModel: .fetchRecommendedRoutine(id) 액션
RoutineCreationViewModel->>RecommendedRoutineUseCase: fetchRecommendedRoutine(id)
RecommendedRoutineUseCase->>RoutineCreationViewModel: RecommendedRoutineEntity 반환
RoutineCreationViewModel->>RoutineCreationView: name/subRoutines 업데이트
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (9)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: choijungp의 homeviewmodel에서 fetchroutines(for date: date) 메서드는 기존 캐시 범위를 확장하는 것이 아니라, 요청된 날짜 주변의 새로운 ...Applied to files:
🧬 Code Graph Analysis (1)Projects/Domain/Sources/UseCase/Routine/RoutineUseCase.swift (1)
⏰ 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)
🔇 Additional comments (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
Projects/DataSource/Sources/Endpoint/RecommendedRoutineEndpoint.swift(2 hunks)Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift(1 hunks)Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift(1 hunks)Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swift(1 hunks)Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift(1 hunks)Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swift(1 hunks)Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift(1 hunks)Projects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swift(2 hunks)Projects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift(4 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: choijungp
PR: YAPP-Github/Bitnagil-iOS#19
File: Projects/Presentation/Sources/Onboarding/View/OnboardingRecommendedRoutineView.swift:57-59
Timestamp: 2025-07-16T09:21:15.038Z
Learning: OnboardingRecommendedRoutineView에서 viewWillAppear에 registerOnboarding 호출하는 것이 적절한 이유: 사용자가 이전 페이지에서 온보딩 선택지를 변경한 후 돌아올 때 새로운 선택지로 다시 등록해야 하기 때문. 홈 뷰에서는 이 뷰로 돌아올 수 없어서 중복 호출 문제가 발생하지 않음.
Learnt from: taipaise
PR: YAPP-Github/Bitnagil-iOS#33
File: Projects/DataSource/Sources/Repository/RoutineRepository.swift:45-46
Timestamp: 2025-08-04T23:43:28.527Z
Learning: taipaise는 디버깅을 위해 명시적인 에러 처리를 선호함. nil 체크 시 조용히 실패하는 것보다 에러를 던지는 방식을 추후 디버깅에 도움이 된다고 생각함.
📚 Learning: onboardingrecommendedroutineview에서 viewwillappear에 registeronboarding 호출하는 것이 적절한 이유: 사용자가 이전 페이지에서 ...
Learnt from: choijungp
PR: YAPP-Github/Bitnagil-iOS#19
File: Projects/Presentation/Sources/Onboarding/View/OnboardingRecommendedRoutineView.swift:57-59
Timestamp: 2025-07-16T09:21:15.038Z
Learning: OnboardingRecommendedRoutineView에서 viewWillAppear에 registerOnboarding 호출하는 것이 적절한 이유: 사용자가 이전 페이지에서 온보딩 선택지를 변경한 후 돌아올 때 새로운 선택지로 다시 등록해야 하기 때문. 홈 뷰에서는 이 뷰로 돌아올 수 없어서 중복 호출 문제가 발생하지 않음.
Applied to files:
Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swiftProjects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swiftProjects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
📚 Learning: choijungp의 homeviewmodel에서 fetchroutines(for date: date) 메서드는 기존 캐시 범위를 확장하는 것이 아니라, 요청된 날짜 주변의 새로운 ...
Learnt from: choijungp
PR: YAPP-Github/Bitnagil-iOS#31
File: Projects/Presentation/Sources/Home/ViewModel/HomeViewModel.swift:97-103
Timestamp: 2025-08-01T06:38:18.687Z
Learning: choijungp의 HomeViewModel에서 fetchRoutines(for date: Date) 메서드는 기존 캐시 범위를 확장하는 것이 아니라, 요청된 날짜 주변의 새로운 데이터 청크를 가져오기 위해 oldestDate와 latestDate를 모두 업데이트한다. 과거 날짜 요청 시에는 해당 날짜의 1주 전~1일 전, 미래 날짜 요청 시에는 해당 날짜의 1일 후~1주 후 범위로 설정한다.
Applied to files:
Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swiftProjects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swiftProjects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift
🧬 Code Graph Analysis (5)
Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swift (1)
Projects/Shared/Sources/DIContainer/DIContainer.swift (1)
resolve(18-25)
Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swift (2)
Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift (1)
fetchRecommendedRoutine(13-20)Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift (1)
fetchRecommendedRoutine(15-18)
Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift (2)
Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift (1)
fetchRecommendedRoutine(13-20)Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift (1)
fetchRecommendedRoutine(15-18)
Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift (1)
Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift (1)
fetchRecommendedRoutine(13-20)
Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift (1)
Projects/Shared/Sources/DIContainer/DIContainer.swift (1)
resolve(18-25)
🔇 Additional comments (9)
Projects/DataSource/Sources/Endpoint/RecommendedRoutineEndpoint.swift (1)
9-9: 깔끔한 엔드포인트 구현입니다.새로운
fetchRecommendedRoutine(id: Int)케이스가 적절히 추가되었고, path 계산 로직도 올바르게 구현되어 있습니다. URL 구성 패턴이 REST API 규칙을 잘 따르고 있습니다.Also applies to: 20-24
Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swift (1)
9-12: 프로토콜 메서드 추가가 적절합니다.새로운 단건 조회 메서드가 기존 패턴과 일관성 있게 추가되었습니다. async/await 패턴과 옵셔널 반환 타입이 적절하며, 한국어 문서화도 명확합니다.
Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift (1)
10-13: 리포지토리 프로토콜 추가가 일관성 있게 구현되었습니다.유스케이스 프로토콜과 동일한 메서드 시그니처를 사용하여 일관성을 유지하고 있으며, 문서화도 적절합니다.
Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift (1)
15-19: 유스케이스 구현이 적절합니다.리포지토리로의 단순한 위임 패턴이 유스케이스 레이어에 적합하며, 에러 전파도 올바르게 처리되고 있습니다.
Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift (1)
13-21: 리포지토리 구현이 기존 패턴과 일관성 있게 작성되었습니다.새로운 엔드포인트를 적절히 사용하고 있으며, 네트워크 요청 처리와 DTO 변환 로직이 기존
fetchRecommendedRoutines()메서드와 동일한 패턴을 따르고 있습니다. Guard 문을 통한 nil 처리도 일관성 있게 구현되어 있습니다.Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift (1)
271-278: 구현이 잘 되었습니다.추천 루틴 카드 탭 시 루틴 생성 화면으로의 네비게이션 로직이 올바르게 구현되었습니다. DI 컨테이너를 통한 의존성 해결, 새로운 이니셜라이저 사용, 그리고 네비게이션 플로우가 기존 코드베이스의 패턴과 일관성 있게 작성되었습니다.
Projects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swift (2)
97-103: 추천 루틴 ID를 받는 새로운 이니셜라이저가 올바르게 구현되었습니다.고정된 타이틀 설정, 상위 클래스 이니셜라이저 호출, 그리고 추천 루틴 데이터 페칭 액션 트리거가 적절하게 구현되어 있습니다. 기존 이니셜라이저와 일관성 있는 패턴을 따르고 있습니다.
538-538: 루틴 등록 후 네비게이션 처리가 추가되었습니다.루틴 등록 완료 후 이전 화면으로 돌아가는 네비게이션 로직이 추가되어 PR 목표였던 네비게이션 이슈가 해결되었습니다.
Projects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift (1)
44-44: 입력 케이스가 올바르게 추가되었습니다.추천 루틴 페칭을 위한 새로운 입력 케이스가 적절하게 정의되었습니다.
| private func fetchRecommenedRoutine(id: Int) { | ||
| Task { | ||
| do { | ||
| guard let routine = try await recommenedRoutineUseCase.fetchRecommendedRoutine(id: id) else { return } | ||
|
|
||
| let subRoutines = routine.subRoutines.map { | ||
| SubRoutineSummaryEntity( | ||
| subRoutineId: nil, | ||
| subRoutineName: $0.title, | ||
| sortOrder: nil) | ||
| } | ||
|
|
||
| nameSubject.send(routine.title) | ||
| subRoutinesSubject.send(subRoutines) | ||
|
|
||
| updateIsRoutineValid() | ||
| } catch { | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
추천 루틴 페칭 로직이 잘 구현되었지만 메서드명 오타와 에러 처리를 개선해주세요.
추천 루틴 데이터를 SubRoutineSummaryEntity로 매핑하고 Subject들을 업데이트하는 로직이 올바르게 구현되었습니다. 다만 메서드명의 오타를 수정하고 빈 catch 블록에 대한 처리가 필요합니다.
- private func fetchRecommenedRoutine(id: Int) {
+ private func fetchRecommendedRoutine(id: Int) {
Task {
do {
- guard let routine = try await recommenedRoutineUseCase.fetchRecommendedRoutine(id: id) else { return }
+ guard let routine = try await recommendedRoutineUseCase.fetchRecommendedRoutine(id: id) else { return }retrieved learning에 따르면 taipaise는 디버깅을 위해 명시적인 에러 처리를 선호하므로, 향후 catch 블록에 적절한 에러 처리 로직을 추가하는 것을 고려해보세요.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private func fetchRecommenedRoutine(id: Int) { | |
| Task { | |
| do { | |
| guard let routine = try await recommenedRoutineUseCase.fetchRecommendedRoutine(id: id) else { return } | |
| let subRoutines = routine.subRoutines.map { | |
| SubRoutineSummaryEntity( | |
| subRoutineId: nil, | |
| subRoutineName: $0.title, | |
| sortOrder: nil) | |
| } | |
| nameSubject.send(routine.title) | |
| subRoutinesSubject.send(subRoutines) | |
| updateIsRoutineValid() | |
| } catch { | |
| } | |
| } | |
| } | |
| private func fetchRecommendedRoutine(id: Int) { | |
| Task { | |
| do { | |
| guard let routine = try await recommendedRoutineUseCase.fetchRecommendedRoutine(id: id) else { return } | |
| let subRoutines = routine.subRoutines.map { | |
| SubRoutineSummaryEntity( | |
| subRoutineId: nil, | |
| subRoutineName: $0.title, | |
| sortOrder: nil) | |
| } | |
| nameSubject.send(routine.title) | |
| subRoutinesSubject.send(subRoutines) | |
| updateIsRoutineValid() | |
| } catch { | |
| // TODO: Handle error explicitly for better debugging. | |
| } | |
| } | |
| } |
🤖 Prompt for AI Agents
In
Projects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift
between lines 160 and 179, fix the typo in the method name from
fetchRecommenedRoutine to fetchRecommendedRoutine. Additionally, improve the
empty catch block by adding proper error handling, such as logging the error or
handling it appropriately to aid debugging and maintain code robustness.
aedb9c5 to
0a415a4
Compare
🌁 Background
📱 Screenshot
👩💻 Contents
✅ Testing
테스트 목적과 상황
시나리오 진행에 필요한 값
시나리오 진행에 필요한 조건
시나리오 완료 시 보장하는 결과
📝 Review Note
Summary by CodeRabbit
신규 기능
개선 사항