mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Balance Interface and OneToOne User -> Balance
This commit is contained in:
parent
964b974142
commit
7282330528
@ -1,4 +1,5 @@
|
||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, JoinColumn, OneToOne } from 'typeorm'
|
||||
import { User } from '../User'
|
||||
|
||||
@Entity('state_balances')
|
||||
export class Balance extends BaseEntity {
|
||||
@ -16,4 +17,8 @@ export class Balance extends BaseEntity {
|
||||
|
||||
@Column({ type: 'bigint' })
|
||||
amount: number
|
||||
|
||||
@OneToOne(() => User, { nullable: false })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user: User
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne } from 'typeorm'
|
||||
import { Balance } from '../Balance'
|
||||
|
||||
// Moriz: I do not like the idea of having two user tables
|
||||
@Entity('state_users')
|
||||
@ -29,4 +30,7 @@ export class User extends BaseEntity {
|
||||
|
||||
@Column()
|
||||
disabled: boolean
|
||||
|
||||
@OneToOne(() => Balance, (balance) => balance.user)
|
||||
balance: Balance
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { TransactionSendCoin } from '../../entity/TransactionSendCoin'
|
||||
import { TransactionCreation } from '../../entity/TransactionCreation'
|
||||
import { User } from '../../entity/User'
|
||||
|
||||
export interface TransactionContext {
|
||||
transactionTypeId?: number
|
||||
@ -10,3 +11,10 @@ export interface TransactionContext {
|
||||
transactionSendCoin?: TransactionSendCoin
|
||||
transactionCreation?: TransactionCreation
|
||||
}
|
||||
|
||||
export interface BalanceContext {
|
||||
modified?: Date
|
||||
recordDate?: Date
|
||||
amount?: number
|
||||
user?: User
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user