-
Notifications
You must be signed in to change notification settings - Fork 0
[CVW-038] 오더북 데이터 저장소 리팩토링 #50
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
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.
Pull Request Overview
This PR refactors the order book data storage by moving its management into the Data layer and updating related use cases and repositories to utilize Combine-based publishers instead of async streams.
- Migrates data storage responsibilities from the Presentation layer to the Data layer
- Introduces new entities (OrderbookTableVO, OrderbookTable) and updates use case protocols accordingly
- Updates networking and repository implementations to use Combine for asynchronous operations
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tuist/Package.swift | Added AdvancedSwift dependency |
| Projects/Utils/CoreUtil/Sources/Export/Export_AdvancedSwift.swift | Added export file for AdvancedSwift module |
| Projects/Utils/CoreUtil/Sources/DataStructure/CVNumber.swift | Added Copyable conformance and a copy() method to CVNumber |
| Projects/Utils/CoreUtil/Sources/Combine+Extension/Publisher+Ex.swift | Introduced mapToVoid() publisher extension |
| Projects/Utils/CoreUtil/Project.swift | Added dependency on AdvancedSwift in the project configuration |
| Projects/Features/CoinDetail/Feature/Sources/CoinDetailPageViewModel.swift | Refactored order book stream processing to use a new use case function |
| Projects/Domain/Interface/UseCase/CoinDetailPageUseCase.swift | Removed outdated methods and introduced getOrderbookTable with Combine |
| Projects/Domain/Interface/Repository/OrderbookRepository.swift | Updated protocol to remove old methods and include a new publisher-based method |
| Projects/Domain/Interface/Entity/Orderbook/* | Removed OrderbookUpdateVO; added OrderbookTableVO and Orderbook |
| Projects/Domain/Concrete/UseCase/DefaultCoinDetailPageUseCase.swift | Updated use case implementation to retrieve and transform order book data |
| Projects/Data/Repository/Sources/* | Updated repository to incorporate Combine and a thread-safe order book store, aligning with new DTO-to-entity adaptations |
| Projects/Data/DataSource/Sources/Service/Network/HTTP/HTTPService.swift | Extended HTTPService with a Combine-based request method |
| Plugins/DependencyPlugin/ProjectDescriptionHelpers/Dependency.swift | Added AdvancedSwift dependency |
Files not reviewed (1)
- Tuist/Package.resolved: Language not supported
변경된 점
오더북 데이터 저장소 리팩토링
기존 데이터 관리
기존 구현의 경우 2가지 문제점이 있다고 판단했습니다.
첫 번째로, 현재 구조는 외부 의존성(Binance API)에 대한 책임이 Presentation 레이어까지 노출된 형태라고 판단됩니다. 이는 클린 아키텍처 원칙에 위배됩니다.
현재 사용 중인 바이낸스 API는 오더북 테이블을 다음과 같은 방식으로 관리합니다:
이 과정은 명확히 외부 API의 프로토콜에 종속적인 처리 로직이며, Presentation 레이어가 알 필요 없는 세부 구현입니다.
해당 절차가 Presentation에 그대로 들어나 있기에 외부환경에 의존하게 됩니다.
두 번째로, 클린 아키텍처 관점에서 이는 적절하지 않습니다.
오더북 테이블 데이터는 단순히 화면에 보여주기 위한 데이터일 뿐이며, 도메인 로직이 개입되지 않는 단순 데이터입니다.
따라서 해당 데이터는 도메인 또는 프레젠테이션 레이어에서 관리하기보다는, 데이터 계층에서 직접 처리하고 전달하는 것이 더 적절한 역할 분리입니다.
변경된 책임
외부 의존적인 관리법과 테이블 데이터 자체를 데이터 레이어로 이동시켰습니다.
정렬 및 슬라이싱과 같은 데이터 가공의 경우 비즈니스 로직이라고 판단되어 도메인 레이어에 위치시켰습니다.