Skip to content

Instantly share code, notes, and snippets.

@cdsap
Last active April 16, 2018 11:29
Show Gist options
  • Save cdsap/4cf62217ec0f3b588f2c6ce6afd17533 to your computer and use it in GitHub Desktop.
Save cdsap/4cf62217ec0f3b588f2c6ce6afd17533 to your computer and use it in GitHub Desktop.
SyncTradesImpl. Client
class SyncTradesImpl @Inject constructor(@Named("remote") private val remoteRepository: GetTradesRepository,
@Named("local") private val localRepository: GetTradesRepository)
: SyncTrades {
override fun syncTrades(id: Long) {
remoteRepository.getTrades(id).trades
.map { TradeDb(it.trade_id, it.rate, it.amount, it.trade_date, it.trade_type) }
.map { localRepository.save(it) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment