mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix transaction type id - too much change
This commit is contained in:
parent
91fda4c097
commit
ae4ad937aa
@ -2,7 +2,7 @@ import { ObjectType, Field } from 'type-graphql'
|
||||
import { Decay } from './Decay'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { TypeId } from '../enum/TypeId'
|
||||
import { TransactionTypeId } from '../enum/TransactionTypeId'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@ -41,8 +41,8 @@ export class Transaction {
|
||||
@Field(() => Number, { nullable: true })
|
||||
previous: number | null
|
||||
|
||||
@Field(() => TypeId)
|
||||
typeId: TypeId
|
||||
@Field(() => TransactionTypeId)
|
||||
typeId: TransactionTypeId
|
||||
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
@ -26,7 +26,7 @@ import { AdminPendingCreation } from '@entity/AdminPendingCreation'
|
||||
import { hasElopageBuys } from '../../util/hasElopageBuys'
|
||||
import { LoginEmailOptIn } from '@entity/LoginEmailOptIn'
|
||||
import { User } from '@entity/User'
|
||||
import { TypeId } from '../enum/TypeId'
|
||||
import { TransactionTypeId } from '../enum/TransactionTypeId'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
// const EMAIL_OPT_IN_REGISTER = 1
|
||||
@ -321,7 +321,7 @@ export class AdminResolver {
|
||||
newBalance = newBalance.add(new Decimal(Number(pendingCreation.amount)))
|
||||
|
||||
const transaction = new Transaction()
|
||||
transaction.typeId = TypeId.CREATION
|
||||
transaction.typeId = TransactionTypeId.CREATION
|
||||
transaction.memo = pendingCreation.memo
|
||||
transaction.userId = pendingCreation.userId
|
||||
// TODO pending creations decimal
|
||||
|
||||
@ -24,7 +24,7 @@ import { User as dbUser } from '@entity/User'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
|
||||
import { apiPost } from '../../apis/HttpRequest'
|
||||
import { TypeId } from '../enum/TypeId'
|
||||
import { TransactionTypeId } from '../enum/TransactionTypeId'
|
||||
import { calculateBalance, isHexPublicKey } from '../../util/validate'
|
||||
import { RIGHTS } from '../../auth/RIGHTS'
|
||||
import { User } from '../model/User'
|
||||
@ -173,7 +173,7 @@ export class TransactionResolver {
|
||||
try {
|
||||
// transaction
|
||||
const transactionSend = new dbTransaction()
|
||||
transactionSend.typeId = TypeId.SEND
|
||||
transactionSend.typeId = TransactionTypeId.SEND
|
||||
transactionSend.memo = memo
|
||||
transactionSend.userId = senderUser.id
|
||||
transactionSend.linkedUserId = recipientUser.id
|
||||
@ -186,7 +186,7 @@ export class TransactionResolver {
|
||||
await queryRunner.manager.insert(dbTransaction, transactionSend)
|
||||
|
||||
const transactionReceive = new dbTransaction()
|
||||
transactionReceive.typeId = TypeId.RECEIVE
|
||||
transactionReceive.typeId = TransactionTypeId.RECEIVE
|
||||
transactionReceive.memo = memo
|
||||
transactionReceive.userId = recipientUser.id
|
||||
transactionReceive.linkedUserId = senderUser.id
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { EntityRepository, Repository } from '@dbTools/typeorm'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
import { Order } from '../../graphql/enum/Order'
|
||||
import { TypeId } from '../../graphql/enum/TypeId'
|
||||
import { TransactionTypeId } from '../../graphql/enum/TransactionTypeId'
|
||||
|
||||
@EntityRepository(Transaction)
|
||||
export class TransactionRepository extends Repository<Transaction> {
|
||||
@ -16,7 +16,7 @@ export class TransactionRepository extends Repository<Transaction> {
|
||||
return this.createQueryBuilder('userTransaction')
|
||||
.where('userTransaction.userId = :userId', { userId })
|
||||
.andWhere('userTransaction.typeId = :typeId', {
|
||||
typeId: TypeId.CREATION,
|
||||
typeId: TransactionTypeId.CREATION,
|
||||
})
|
||||
.orderBy('userTransaction.balanceDate', order)
|
||||
.limit(limit)
|
||||
|
||||
@ -3,7 +3,7 @@ import Decimal from 'decimal.js-light'
|
||||
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import { calculateDecay } from './decay'
|
||||
import { TypeId } from '../graphql/enum/TypeId'
|
||||
import { TransactionTypeId } from '../graphql/enum/TransactionTypeId'
|
||||
import { Transaction } from '../graphql/model/Transaction'
|
||||
import { User } from '../graphql/model/User'
|
||||
|
||||
@ -19,7 +19,7 @@ const virtualDecayTransaction = (
|
||||
id: -1,
|
||||
userId: -1,
|
||||
previous: -1,
|
||||
typeId: TypeId.DECAY,
|
||||
typeId: TransactionTypeId.DECAY,
|
||||
amount: decay.decay ? decay.decay : new Decimal(0), // new Decimal(0), // this kinda is wrong, but helps with the frontend query
|
||||
balance: decay.balance,
|
||||
balanceDate: time,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user