From 5d3ef15a479f49daf00c2e6e2693b490faee2553 Mon Sep 17 00:00:00 2001 From: Masudur Rahman Date: Mon, 1 Apr 2024 13:50:03 +0600 Subject: [PATCH] Update balance checking where clause Signed-off-by: Masudur Rahman --- repos/accounts/accounts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/accounts/accounts.go b/repos/accounts/accounts.go index 0de0890..336e45a 100644 --- a/repos/accounts/accounts.go +++ b/repos/accounts/accounts.go @@ -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 {