Skip to content

Conversation

@J0onYEong
Copy link
Collaborator

@J0onYEong J0onYEong commented May 4, 2025

변경된 점

  • 유저 설정 레포지토리 리팩토링

유저 설정 레포지토리 리팩토링

기존 구현의 경우 클린 아키텍처 관점에서 역할 분배가 재대로 되어 있지 않다고 판단하여 수정하였습니다.

  • 기존구현
Domain 저장을 위한 키값 결정(엔티티에 해당 프로퍼티가 포함된 구조)
Data-Repository 변경 정보 캐싱, DTO를 엔티티화
Data-Service Key-Value형태로 데이터를 저장
  • 변경된 구현

ViewModel이 레포지토리에 직접 접근하지 않고 SettingPageUseCase를 거치도록 수정했습니다.
개념적 통용을 위해 UseCase를 생성하는 것이 올바르다고 판단했습니다.

※ 설정 값이 올바르게 쓰기, 읽기 되는지 확인하기 위해 데이터 소스 테스트코드를 작성했습니다.

Domain 값이 없는 경우 기본값 결정
Data-Repository DTO를 엔티티화
Data-DataSource 설정정보 캐싱, 저장할 위한 키값 결정, 저장 데이터를 DTO로 파싱
Data-Service Key-Value형태로 데이터를 저장

@J0onYEong J0onYEong requested a review from Copilot May 4, 2025 09:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the user configuration repository to better adhere to clean architecture principles by introducing a use case layer and streamlining configuration handling.

  • Introduces SettingPageUseCase to decouple the view model from the repository.
  • Updates configuration entity handling by migrating default value logic to enum default properties and removing redundant caching in the repository.
  • Adjusts dependency injection registration across Domain, Data, and App assemblies.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Projects/Domain/Interface/UseCase/SettingPageUseCase.swift New use case interface for setting page.
Projects/Domain/Interface/Repository/UserConfigurationRepository.swift Updated repository protocol returning optionals.
Projects/Domain/Interface/Entity/Configuration/*.swift Removed savingValue properties and added defaultValue properties.
Projects/Domain/Concrete/UseCase/DefaultSettingPageUseCase.swift Use case implementation using nil-coalescing to supply defaults.
Projects/Domain/Concrete/UseCase/DefaultAllMarketTickersUseCase.swift Updated grid type retrieval to use nil-coalescing.
Projects/Data/Tests/UserConfigurationDataSourceTests.swift New tests for the user configuration data source.
Projects/Data/Repository/DefaultUserConfigurationRepository.swift Refactored repository to use the data source and removed caching.
DI Assemblies (SharedAssembly.swift, DomainAssembly.swift, DataAssembly.swift) Updated dependency registrations for the refactored services and use cases.
Comments suppressed due to low confidence (1)

Projects/Data/Tests/UserConfigurationDataSourceTests.swift:15

  • [nitpick] The function name 'checkConfiguratonSaving' contains a typo; consider renaming it to 'checkConfigurationSaving' for better clarity.
func checkConfiguratonSaving() {

@J0onYEong J0onYEong merged commit f934806 into main May 4, 2025
1 check passed
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