make transaction a const

This commit is contained in:
Ulf Gebhardt 2022-02-24 12:51:47 +01:00
parent cc395cf31f
commit c2dfd50654
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -316,7 +316,7 @@ export class AdminResolver {
}
newBalance = Number(newBalance) + Number(parseInt(pendingCreation.amount.toString()))
let transaction = new Transaction()
const transaction = new Transaction()
transaction.typeId = TransactionTypeId.CREATION
transaction.memo = pendingCreation.memo
transaction.userId = pendingCreation.userId
@ -324,8 +324,7 @@ export class AdminResolver {
transaction.creationDate = pendingCreation.date
transaction.balance = BigInt(newBalance)
transaction.balanceDate = receivedCallDate
transaction = await transaction.save()
// if (!transaction) throw new Error('Could not create transaction')
await transaction.save()
let userBalance = await Balance.findOne({ userId: pendingCreation.userId })
if (!userBalance) {