updateUserBalance: allow negative balances

This commit is contained in:
mantikoros 2022-03-08 11:34:08 -06:00
parent 4a0db10b20
commit 82c5eb85d3

View File

@ -53,10 +53,10 @@ const updateUserBalance = (
const newUserBalance = user.balance + delta const newUserBalance = user.balance + delta
if (newUserBalance < 0) // if (newUserBalance < 0)
throw new Error( // throw new Error(
`User (${userId}) balance cannot be negative: ${newUserBalance}` // `User (${userId}) balance cannot be negative: ${newUserBalance}`
) // )
if (isDeposit) { if (isDeposit) {
const newTotalDeposits = (user.totalDeposits || 0) + delta const newTotalDeposits = (user.totalDeposits || 0) + delta