updated entities

This commit is contained in:
Ulf Gebhardt 2022-02-26 00:19:16 +01:00
parent 850be8a890
commit 32dea81a36
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
5 changed files with 87 additions and 5 deletions

View File

@ -79,7 +79,7 @@ export class Transaction extends BaseEntity {
@Column({ name: 'balance', type: 'bigint', default: 0 })
balance: BigInt
@Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null })
@Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null })
creationDate: Date
@Column({

View File

@ -0,0 +1,85 @@
import Decimal from 'decimal.js-light'
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
@Entity('transactions')
export class Transaction extends BaseEntity {
@PrimaryGeneratedColumn('increment', { unsigned: true })
id: number
@Column({ name: 'user_id', unsigned: true, nullable: false })
userId: number
@Column({ unsigned: true, nullable: true, default: null })
previous: number
@Column({ name: 'type_id', unsigned: true, nullable: false })
typeId: number
@Column({
type: 'decimal',
precision: 40,
scale: 20,
nullable: false,
transformer: DecimalTransformer,
})
amount: Decimal
@Column({
type: 'decimal',
precision: 40,
scale: 20,
nullable: false,
transformer: DecimalTransformer,
})
balance: Decimal
@Column({
name: 'balance_date',
type: 'datetime',
default: () => 'CURRENT_TIMESTAMP',
nullable: false,
})
balanceDate: Date
@Column({
type: 'decimal',
precision: 40,
scale: 20,
nullable: false,
transformer: DecimalTransformer,
})
decay: Decimal
@Column({
name: 'decay_start',
type: 'datetime',
nullable: true,
default: null,
})
decayStart: Date | null
@Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' })
memo: string
@Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null })
creationDate: Date
@Column({
name: 'linked_user_id',
type: 'int',
unsigned: true,
nullable: true,
default: null,
})
linkedUserId?: number | null
@Column({
name: 'linked_transaction_id',
type: 'int',
unsigned: true,
nullable: true,
default: null,
})
linkedTransactionId?: number | null
}

View File

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

View File

@ -1 +1 @@
export { Transaction } from './0027-decimal_types/Transaction'
export { Transaction } from './0028-clean_transaction_table/Transaction'

View File

@ -1,4 +1,3 @@
import { Balance } from './Balance'
import { LoginElopageBuys } from './LoginElopageBuys'
import { LoginEmailOptIn } from './LoginEmailOptIn'
import { Migration } from './Migration'
@ -10,7 +9,6 @@ import { AdminPendingCreation } from './AdminPendingCreation'
export const entities = [
AdminPendingCreation,
Balance,
LoginElopageBuys,
LoginEmailOptIn,
Migration,