updated entities

This commit is contained in:
Ulf Gebhardt 2022-02-20 03:10:54 +01:00
parent 0bdd52989a
commit bfde22b261
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
7 changed files with 70 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne } from 'typeorm'
import { TransactionCreation } from '../TransactionCreation'
import { TransactionSendCoin } from '../TransactionSendCoin'
import { TransactionCreation } from './TransactionCreation'
import { TransactionSendCoin } from './TransactionSendCoin'
@Entity('transactions')
export class Transaction extends BaseEntity {

View File

@ -1,6 +1,6 @@
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne } from 'typeorm'
import { TransactionCreation } from '../TransactionCreation'
import { TransactionSendCoin } from '../TransactionSendCoin'
import { TransactionCreation } from '../0001-init_db/TransactionCreation'
import { TransactionSendCoin } from '../0001-init_db/TransactionSendCoin'
@Entity('transactions')
export class Transaction extends BaseEntity {

View File

@ -0,0 +1,65 @@
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne } from 'typeorm'
@Entity('transactions')
export class Transaction extends BaseEntity {
// TODO the id is defined as bigint(20) - there might be problems with that: https://github.com/typeorm/typeorm/issues/2400
@PrimaryGeneratedColumn('increment', { unsigned: true })
id: number
@Column({ name: 'transaction_type_id', unsigned: true, length: 10, nullable: false })
transactionTypeId: number
@Column({ name: 'user_id', unsigned: true, length: 10, nullable: false })
userId: number
@Column({ type: 'bigint', length: 20, nullable: false })
amount: BigInt
@Column({ name: 'tx_hash', type: 'binary', length: 48, default: null, nullable: true })
txHash: Buffer
@Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' })
memo: string
@Column({ type: 'timestamp', nullable: false, default: () => 'CURRENT_TIMESTAMP' })
received: Date
@Column({ type: 'binary', length: 64, nullable: true, default: null })
signature: Buffer
@Column({ type: 'binary', length: 32, nullable: true, default: null })
pubkey: Buffer
@Column({
name: 'creation_ident_hash',
type: 'binary',
length: 32,
nullable: true,
default: null,
})
creationIdentHash: Buffer
@Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null })
creationDate: Date
@Column({
name: 'send_receiver_public_key',
type: 'binary',
length: 32,
nullable: true,
default: null,
})
sendReceiverPublicKey: Buffer
@Column({
name: 'send_receiver_user_id',
unsigned: true,
length: 10,
nullable: true,
default: null,
})
sendReceiverUserId: number
@Column({ name: 'send_sender_final_balance', length: 20, nullable: true, default: null })
sendSenderFinalBalance: BigInt
}

View File

@ -1 +1 @@
export { Transaction } from './0016-transaction_signatures/Transaction'
export { Transaction } from './0024-combine_transaction_tables/Transaction'

View File

@ -1 +0,0 @@
export { TransactionCreation } from './0001-init_db/TransactionCreation'

View File

@ -1 +0,0 @@
export { TransactionSendCoin } from './0001-init_db/TransactionSendCoin'

View File

@ -4,8 +4,6 @@ import { LoginEmailOptIn } from './LoginEmailOptIn'
import { Migration } from './Migration'
import { ServerUser } from './ServerUser'
import { Transaction } from './Transaction'
import { TransactionCreation } from './TransactionCreation'
import { TransactionSendCoin } from './TransactionSendCoin'
import { User } from './User'
import { UserSetting } from './UserSetting'
import { UserTransaction } from './UserTransaction'
@ -19,8 +17,6 @@ export const entities = [
Migration,
ServerUser,
Transaction,
TransactionCreation,
TransactionSendCoin,
User,
UserSetting,
UserTransaction,