diff --git a/database/entity/0030-transaction_link/TransactionLink.ts b/database/entity/0030-transaction_link/TransactionLink.ts new file mode 100644 index 000000000..11f1be6a3 --- /dev/null +++ b/database/entity/0030-transaction_link/TransactionLink.ts @@ -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 +} diff --git a/database/entity/TransactionLink.ts b/database/entity/TransactionLink.ts new file mode 100644 index 000000000..fde2ba9e0 --- /dev/null +++ b/database/entity/TransactionLink.ts @@ -0,0 +1 @@ +export { TransactionLink } from './0030-transaction_link/TransactionLink' diff --git a/database/entity/index.ts b/database/entity/index.ts index bee4e2b77..cb6f56ab0 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -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, ]