From 70a0a2664b3df07b115daabecc0dbcc37919ec33 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 20 Feb 2022 13:21:12 +0100 Subject: [PATCH] properly use js array operators (find) --- backend/src/graphql/resolver/TransactionResolver.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 9c7c8b93f..edbe6373e 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -117,11 +117,11 @@ async function calculateAndAddDecayTransactions( finalTransaction.balance = roundFloorFrom4(Number(transaction.amount)) // Todo unsafe conversion if (transaction.userId === user.id) { finalTransaction.type = TransactionType.SEND - otherUser = userIndiced[transaction.sendReceiverUserId!] // TODO properly enforce null + otherUser = userIndiced.find((u) => u.id === transaction.sendReceiverUserId) // TODO properly enforce null // finalTransaction.pubkey = sendCoin.recipiantPublic } else if (transaction.sendReceiverUserId === user.id) { finalTransaction.type = TransactionType.RECIEVE - otherUser = userIndiced[transaction.userId] + otherUser = userIndiced.find((u) => u.id === transaction.userId) // finalTransaction.pubkey = sendCoin.senderPublic } else { throw new Error('invalid transaction')