mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add balance and balance_date to account
This commit is contained in:
parent
b611da90f4
commit
ac5e93c813
@ -14,6 +14,8 @@ import { User } from './User'
|
||||
import { Community } from './Community'
|
||||
import { TransactionRecipe } from './TransactionRecipe'
|
||||
import { ConfirmedTransaction } from './ConfirmedTransaction'
|
||||
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@Entity('accounts')
|
||||
export class Account {
|
||||
@ -41,13 +43,24 @@ export class Account {
|
||||
name: 'created_at',
|
||||
type: 'datetime',
|
||||
default: () => 'CURRENT_TIMESTAMP',
|
||||
nullable: false,
|
||||
})
|
||||
createdAt: Date
|
||||
|
||||
@Column({ name: 'confirmed_at', type: 'datetime', nullable: true })
|
||||
confirmedAt?: Date
|
||||
|
||||
@Column({
|
||||
type: 'decimal',
|
||||
precision: 40,
|
||||
scale: 20,
|
||||
default: 0,
|
||||
transformer: DecimalTransformer,
|
||||
})
|
||||
balance: Decimal
|
||||
|
||||
@Column({ name: 'balance_date', type: 'datetime' })
|
||||
balanceDate: Date
|
||||
|
||||
@OneToOne(() => Community, (community) => community.gmwAccount)
|
||||
gmwCommunity?: Community
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
\`type\` tinyint unsigned NOT NULL,
|
||||
\`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
\`confirmed_at\` datetime DEFAULT NULL,
|
||||
\`balance\` decimal(40,20) NOT NULL DEFAULT 0,
|
||||
\`balance_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (\`id\`),
|
||||
UNIQUE KEY \`pubkey\` (\`pubkey\`),
|
||||
FOREIGN KEY (\`user_id\`) REFERENCES users(id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user