entity transaction link

This commit is contained in:
Moriz Wahl 2022-03-09 11:55:36 +01:00
parent 5f5bde2f0f
commit 19084d7514
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,55 @@
import Decimal from 'decimal.js-light'
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
@Entity('transaction_links')
export class Transaction extends BaseEntity {
@PrimaryGeneratedColumn('increment', { unsigned: true })
id: number
@Column({ unsigned: true, nullable: false })
userId: number
@Column({
type: 'decimal',
precision: 40,
scale: 20,
nullable: false,
transformer: DecimalTransformer,
})
amount: Decimal
@Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' })
memo: string
@Column({
type: 'datetime',
default: () => 'CURRENT_TIMESTAMP',
nullable: false,
})
createdAt: Date
@Column({
type: 'datetime',
default: () => 'CURRENT_TIMESTAMP',
nullable: false,
})
validUntil: Date
@Column({
type: 'datetime',
default: () => 'CURRENT_TIMESTAMP',
nullable: true,
})
redeemedAt: Date
@Column({
type: 'boolean',
default: () => false,
nullable: false,
})
showEmail: boolean
@Column({ unsigned: true, nullable: true })
redeemedBy: number
}

View File

@ -0,0 +1 @@
export { TransactionLink } from './0030-transaction_link/TransactionLink'

View File

@ -3,6 +3,7 @@ import { LoginEmailOptIn } from './LoginEmailOptIn'
import { Migration } from './Migration'
import { ServerUser } from './ServerUser'
import { Transaction } from './Transaction'
import { TransactionLink } from './TransactionLink'
import { User } from './User'
import { UserSetting } from './UserSetting'
import { AdminPendingCreation } from './AdminPendingCreation'
@ -14,6 +15,7 @@ export const entities = [
Migration,
ServerUser,
Transaction,
TransactionLink,
User,
UserSetting,
]