Create Operation, Transfer and Equivalent value Entities for the Room database.
This commit is contained in:
parent
72e39368aa
commit
da9e0225cc
3 changed files with 72 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
package cy.agorise.bitsybitshareswallet.models
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "equivalent_values",foreignKeys =
|
||||
[ForeignKey(
|
||||
entity = Transfer::class,
|
||||
parentColumns = ["operation_id"],
|
||||
childColumns = ["transfer_id"],
|
||||
onUpdate = ForeignKey.CASCADE,
|
||||
onDelete = ForeignKey.CASCADE
|
||||
), ForeignKey(
|
||||
entity = Asset::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["asset_id"],
|
||||
onUpdate = ForeignKey.CASCADE,
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)]
|
||||
)
|
||||
data class EquivalentValue (
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id") val id: Long,
|
||||
@ColumnInfo(name = "transfer_id") val transferId: String,
|
||||
@ColumnInfo(name = "value") val value: Long,
|
||||
@ColumnInfo(name = "asset_id") val assetId: String
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
package cy.agorise.bitsybitshareswallet.models
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "operations")
|
||||
data class Operation (
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id") val id: String,
|
||||
@ColumnInfo(name = "type") val type: Int,
|
||||
@ColumnInfo(name = "timestamp") val timestamp: Long,
|
||||
@ColumnInfo(name = "block_number") val blockNumber: Long
|
||||
)
|
|
@ -0,0 +1,29 @@
|
|||
package cy.agorise.bitsybitshareswallet.models
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "transfers",foreignKeys =
|
||||
[ForeignKey(
|
||||
entity = Operation::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["operation_id"],
|
||||
onUpdate = ForeignKey.CASCADE,
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)]
|
||||
)
|
||||
data class Transfer (
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "operation_id") val operationId: String,
|
||||
@ColumnInfo(name = "fee_amount") val feeAmount: Long,
|
||||
@ColumnInfo(name = "fee_asset_id") val feeAssetId: String,
|
||||
@ColumnInfo(name = "source") val source: String,
|
||||
@ColumnInfo(name = "destination") val destination: String,
|
||||
@ColumnInfo(name = "transfer_amount") val transferAmount: Long,
|
||||
@ColumnInfo(name = "transfer_asset_id") val transferAssetId: String,
|
||||
@ColumnInfo(name = "memo") val memo: String,
|
||||
@ColumnInfo(name = "memo_from_key") val memoFromKey: String,
|
||||
@ColumnInfo(name = "memo_to_key") val memoToKey: String
|
||||
)
|
Loading…
Reference in a new issue