Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the responsibility for handling coin trade information by moving trade data processing into the domain layer and updating repository and data source interfaces accordingly. Key changes include:
- Removal of the TradeContainer and associated logic in the CoinDetailPageViewModel.
- Introduction of new publisher-based methods for retrieving recent coin trades in the use case and repository layers.
- Updates to dependency injection in DI assemblies along with removal of outdated repository implementations.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Projects/Utils/CoreUtil/Sources/Swift+Extension/Type+Copyable.swift | Adds retroactive conformance for Date and Int64 to the Copyable protocol. |
| Projects/Utils/CoreUtil/Sources/DataStructure/ThreadSafeHashMap.swift | Introduces an actor-based thread-safe hash map. |
| Projects/Features/CoinDetail/Feature/Sources/Model/TradeContainer.swift | Removes the TradeContainer, shifting responsibility for trade data handling. |
| Projects/Features/CoinDetail/Feature/Sources/CoinDetailPageViewModel.swift | Updates recent trade stream handling to use a publisher that returns a pre-processed trade list. |
| Projects/Features/CoinDetail/Example/Sources/DI/Assemblies.swift | Adjusts DI registrations to use the new CoinTradeRepository and CoinTradeDataSource. |
| Projects/Domain/Interface/UseCase/CoinDetailPageUseCase.swift | Updates the interface for retrieving recent trades to return an AnyPublisher of trade lists. |
| Projects/Domain/Interface/Repository/* | Removes the old TradeRepository interface and adds CoinTradeRepository. |
| Projects/Domain/Concrete/UseCase/DefaultCoinDetailPageUseCase.swift | Adapts the coin trade use case to the new publisher-based interface. |
| Projects/Data/Repository/Sources/Util/ThreadSafeOrderbookHashMap.swift | Deletes the old thread-safe orderbook hash map in favor of the newer implementation. |
| Projects/Data/Repository/Sources/BinanceTradeRepository.swift | Removes the old BinanceTradeRepository. |
| Projects/Data/Repository/Sources/BinanceOrderbookRepository.swift | Updates orderbook store types to use ThreadSafeHashMap with explicit generic parameters. |
| Projects/Data/Repository/Sources/BinanceCoinTradeRepository.swift | Introduces the new BinanceCoinTradeRepository that maps DTOs to domain entities. |
| Projects/Data/DataSource/Sources/DataSource/CoinTradeDataSource.swift | Adds a new data source for handling coin trade DTOs using a reactive publisher. |
| Projects/App/Sources/DI/Assembly/DataAssembly.swift | Updates DI assembly registrations to use the new data source and repository types. |
Comments suppressed due to low confidence (2)
Projects/Features/CoinDetail/Feature/Sources/CoinDetailPageViewModel.swift:213
- The previous TradeContainer logic that handled insertion, sorting, and limiting of trades has been completely removed. Please verify that the new publisher-based approach fully replicates the intended data-processing behavior.
func listenToRecentTradeStream() {
Projects/Data/DataSource/Sources/DataSource/CoinTradeDataSource.swift:35
- The data source uses an Int64 key for trade times while the repository mapping later uses these values to construct entities keyed by Date. Please ensure that this type conversion is intentional and consistent across the layers.
await source.tradeList.insert(key: dto.tradeTime, value: dto)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경된 점
코인 거래내역 정보 객체 책임 리팩토링
기존 책임 분리
기존방식의 클린아키텍처에 어긋납니다.
거래정보의 경우 데이터 레이어에 위치시키고 도메인 로직에 따라 정렬 및 가공을 하는 것이 올바릅니다.
변경된 책임
불필요하게 많은 데이터 업데이트 되는 것을 방지하기 위해 도메인 레이어에서 테이블의 업데이트 주기를 결정하도록 했습니다.
※ 해당 제약의 경우 UI업데이트와 무관한 데이터 업데이트입니다.
Repository의 책임은 DTO를 엔티티로 적응시키는 것임으로 DataSource객체를 만들어 전체 거래내역정보를 관리하도록 했습니다.