Skip to content

[Feat] 추천 루틴 등록하기 기능 추가#40

Merged
choijungp merged 2 commits intodevelopfrom
fix/routine-edition
Aug 7, 2025
Merged

[Feat] 추천 루틴 등록하기 기능 추가#40
choijungp merged 2 commits intodevelopfrom
fix/routine-edition

Conversation

@taipaise
Copy link
Copy Markdown
Collaborator

@taipaise taipaise commented Aug 7, 2025

🌁 Background

  • 루틴 등록/수정 시 뒤로 가지 못하는 치명적인 문제를 고쳐야 했습니다..
  • 더불어 인지하지 못했던 추천 루틴 추가 기능을 붙였습니다!

📱 Screenshot

iPhone SE3 iPhone 13 mini iPhone 16 Pro
se3 13mini 16pro

👩‍💻 Contents

  • 루틴 등록/수정 완료 후 뒤로 가기 기능 추가
  • 추천 루틴 선택 시 루틴 등록 화면으로 이동하도록 함

✅ Testing

  • 테스트 목적과 상황

  • 시나리오 진행에 필요한 값

  • 시나리오 진행에 필요한 조건

  • 시나리오 완료 시 보장하는 결과

📝 Review Note

  • 추천 루틴 조회 (단건)을 RecommenedRoutine 관련 객체에 구현했습니다. (usecase, repository, endpoint)
  • 일단 급한대로, 잘 구현해두신 RecommendedRoutine 관련 객체들을 사용했습니다!! 조금 아쉬웠던 점은, RecommendedRoutine과 Routine을 통일해서 쓸 수 있다면 좋을것 같다는 생각이 들었습니다! response를 내려줄 때 최대한 통일해서 주면 훨씬 깔끔한 구조로 리팩터링이 가능하지 않을까요?? 서버 분들과 관련해서 이야기 나눠보면 좋을 것 같습니다.

Summary by CodeRabbit

  • 신규 기능

    • 추천 루틴을 ID로 조회하여 루틴 등록 화면에서 불러올 수 있는 기능이 추가되었습니다.
    • 추천 루틴 카드 선택 시, 해당 루틴을 기반으로 루틴 등록 화면으로 이동합니다.
    • 루틴 등록 화면에서 추천 루틴의 제목과 하위 루틴 정보가 자동으로 입력됩니다.
  • 개선 사항

    • 루틴 등록 완료 시, 등록 화면이 자동으로 닫히도록 개선되었습니다.

@taipaise taipaise requested a review from choijungp August 7, 2025 13:25
@taipaise taipaise self-assigned this Aug 7, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 7, 2025

Walkthrough

이 변경 사항은 추천 루틴을 ID로 단일 조회하는 기능을 전 계층에 걸쳐 추가합니다. 엔드포인트, 리포지토리, 유스케이스, 프로토콜, 뷰모델, DI 조립, 뷰 등에서 관련 메서드와 생성자, DI 주입, 네비게이션 처리가 도입되었습니다. 기존 목록 조회 로직은 그대로 유지됩니다.

Changes

Cohort / File(s) Change Summary
Endpoint 및 데이터 계층 확장
Projects/DataSource/Sources/Endpoint/RecommendedRoutineEndpoint.swift, Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift
추천 루틴 단일 조회를 위한 엔드포인트 case 및 리포지토리 메서드 추가.
도메인 프로토콜 및 유스케이스 확장
Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift, Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swift, Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift
추천 루틴 단일 조회 메서드를 프로토콜과 유스케이스에 추가 및 구현.
DI 및 의존성 주입 수정
Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swift
RoutineCreationViewModel 등록 시 RecommendedRoutineUseCaseProtocol도 함께 주입하도록 변경.
추천 루틴 상세 조회 및 네비게이션 구현
Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift, Projects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swift
추천 루틴 카드 클릭 시, RoutineCreationView로 네비게이션 및 추천 루틴 ID 전달. RoutineCreationView에 추천 루틴 ID를 받는 생성자 추가 및 등록 버튼 동작 수정.
RoutineCreationViewModel 확장
Projects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift
추천 루틴 단일 조회용 Input 케이스, 의존성, 비동기 fetch 메서드 추가 및 액션 분기 구현.
RoutineUseCase 및 관련 프로토콜 메서드명 변경
Projects/Domain/Sources/Protocol/UseCase/RoutineUseCaseProtocol.swift, Projects/Domain/Sources/UseCase/Routine/RoutineUseCase.swift, Projects/Presentation/Sources/Home/ViewModel/HomeViewModel.swift
updateRoutineCompletionupdateRoutineCompletions로 메서드명 변경 및 호출부 수정.

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 업데이트
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Suggested reviewers

  • taipaise

Poem

🐰
새싹 루틴, 하나씩 콕 집어
토끼 손으로 코드에 불어넣네
추천 받아 똑똑, 네비게이션 쏙쏙
뷰모델도 든든하게 의존성 꽉꽉
오늘도 루틴 한 그루,
코드를 타고 자라난다—
깡총!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aedb9c5 and 0a415a4.

📒 Files selected for processing (12)
  • 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/Protocol/UseCase/RoutineUseCaseProtocol.swift (1 hunks)
  • Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift (1 hunks)
  • Projects/Domain/Sources/UseCase/Routine/RoutineUseCase.swift (1 hunks)
  • Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swift (1 hunks)
  • Projects/Presentation/Sources/Home/ViewModel/HomeViewModel.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)
✅ Files skipped from review due to trivial changes (2)
  • Projects/Presentation/Sources/Home/ViewModel/HomeViewModel.swift
  • Projects/Domain/Sources/Protocol/UseCase/RoutineUseCaseProtocol.swift
🚧 Files skipped from review as they are similar to previous changes (9)
  • Projects/Domain/Sources/UseCase/RecommendedRoutine/RecommendedRoutineUseCase.swift
  • Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift
  • Projects/DataSource/Sources/Endpoint/RecommendedRoutineEndpoint.swift
  • Projects/Domain/Sources/Protocol/UseCase/RecommendedRoutineUseCaseProtocol.swift
  • Projects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swift
  • Projects/DataSource/Sources/Repository/RecommendedRoutineRepository.swift
  • Projects/Presentation/Sources/Common/PresentationDependencyAssembler.swift
  • Projects/Presentation/Sources/RoutineCreation/ViewModel/RoutineCreationViewModel.swift
  • Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
🧰 Additional context used
🧠 Learnings (2)
📓 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: 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/UseCase/Routine/RoutineUseCase.swift
🧬 Code Graph Analysis (1)
Projects/Domain/Sources/UseCase/Routine/RoutineUseCase.swift (1)
Projects/DataSource/Sources/Repository/RoutineRepository.swift (1)
  • updateRoutineCompletions (88-103)
⏰ 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 (1)
Projects/Domain/Sources/UseCase/Routine/RoutineUseCase.swift (1)

82-84: 메서드명 변경이 적절합니다.

updateRoutineCompletion에서 updateRoutineCompletions로의 변경은 메서드가 배열 파라미터를 받아 여러 루틴 완료 상태를 처리한다는 점을 고려할 때 복수형이 더 정확한 표현입니다. 리포지토리 메서드명과도 일치하여 코드베이스 전반의 일관성이 향상되었습니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/routine-edition

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @coderabbitai 요약 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7726a5a and aedb9c5.

📒 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.swift
  • Projects/Presentation/Sources/RoutineCreation/View/RoutineCreationView.swift
  • Projects/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.swift
  • Projects/Domain/Sources/Protocol/Repository/RecommendedRoutineRepositoryProtocol.swift
  • Projects/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: 입력 케이스가 올바르게 추가되었습니다.

추천 루틴 페칭을 위한 새로운 입력 케이스가 적절하게 정의되었습니다.

Comment on lines +160 to +179
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 {
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

추천 루틴 페칭 로직이 잘 구현되었지만 메서드명 오타와 에러 처리를 개선해주세요.

추천 루틴 데이터를 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.

Suggested change
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.

@choijungp choijungp force-pushed the fix/routine-edition branch from aedb9c5 to 0a415a4 Compare August 7, 2025 16:14
@choijungp choijungp merged commit 83f35cd into develop Aug 7, 2025
2 checks passed
@choijungp choijungp deleted the fix/routine-edition branch August 7, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants