updateUserBalance: allow negative balances
This commit is contained in:
parent
4a0db10b20
commit
82c5eb85d3
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user