2018-12-03 19:34:13 +00:00
|
|
|
package cy.agorise.bitsybitshareswallet.repositories
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import androidx.lifecycle.LiveData
|
|
|
|
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
2019-11-06 21:53:39 +00:00
|
|
|
import cy.agorise.bitsybitshareswallet.database.daos.EquivalentValueDao
|
2018-12-03 19:34:13 +00:00
|
|
|
import cy.agorise.bitsybitshareswallet.database.joins.TransferDetail
|
|
|
|
import cy.agorise.bitsybitshareswallet.database.joins.TransferDetailDao
|
|
|
|
|
|
|
|
class TransferDetailRepository internal constructor(context: Context) {
|
|
|
|
|
|
|
|
private val mTransferDetailDao: TransferDetailDao
|
2019-11-06 21:53:39 +00:00
|
|
|
private val mEquivalentValuesDao: EquivalentValueDao
|
2018-12-03 19:34:13 +00:00
|
|
|
|
|
|
|
init {
|
|
|
|
val db = BitsyDatabase.getDatabase(context)
|
|
|
|
mTransferDetailDao = db!!.transferDetailDao()
|
2019-11-06 21:53:39 +00:00
|
|
|
mEquivalentValuesDao = db.equivalentValueDao()
|
2018-12-03 19:34:13 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 23:17:00 +00:00
|
|
|
fun get(userId: String, transferId: String): LiveData<TransferDetail> {
|
|
|
|
return mTransferDetailDao.get(userId, transferId)
|
|
|
|
}
|
|
|
|
|
2019-11-06 21:53:39 +00:00
|
|
|
fun getAll(userId: String, currency: String): LiveData<List<TransferDetail>> {
|
|
|
|
return mTransferDetailDao.getAll(userId, currency)
|
2018-12-03 19:34:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|