Skip to content

Commit

Permalink
Update balance checking where clause
Browse files Browse the repository at this point in the history
Signed-off-by: Masudur Rahman <[email protected]>
  • Loading branch information
masudur-rahman committed Apr 1, 2024
1 parent 8a805d4 commit 5d3ef15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion repos/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (a *SQLAccountsRepository) UpdateAccountBalance(userID int64, accID string,
acc.LastTxnAmount = txnAmount
acc.LastTxnTimestamp = time.Now().Unix()

return a.db.ID(acc.ID).MustCols("balance").UpdateOne(acc)
return a.db.Where("id = ? AND user_id = ?", accID, userID).MustCols("balance").UpdateOne(acc)
}

func (a *SQLAccountsRepository) DeleteAccount(userID int64, accID string) error {
Expand Down

0 comments on commit 5d3ef15

Please sign in to comment.