From 6386ec8caadc765e0b916aff4f6353dccfc181d9 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 8 Sep 2025 02:26:40 +0800 Subject: [PATCH] :bug: Fix transaction listing --- DysonNetwork.Pass/Wallet/WalletController.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DysonNetwork.Pass/Wallet/WalletController.cs b/DysonNetwork.Pass/Wallet/WalletController.cs index 70f656e..7c28121 100644 --- a/DysonNetwork.Pass/Wallet/WalletController.cs +++ b/DysonNetwork.Pass/Wallet/WalletController.cs @@ -46,11 +46,14 @@ public class WalletController(AppDatabase db, WalletService ws, PaymentService p { if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + var accountWallet = await db.Wallets.Where(w => w.AccountId == currentUser.Id).FirstOrDefaultAsync(); + if (accountWallet is null) return NotFound(); + var query = db.PaymentTransactions.AsQueryable() .Include(t => t.PayeeWallet) .Include(t => t.PayerWallet) - .Where(t => (t.PayeeWallet != null && t.PayeeWallet.AccountId == currentUser.Id) || - (t.PayerWallet != null && t.PayerWallet.AccountId == currentUser.Id)); + .Where(t => (t.PayeeWallet == null || t.PayeeWalletId == accountWallet.Id) || + (t.PayerWallet == null || t.PayerWalletId == accountWallet.Id)); var transactionCount = await query.CountAsync(); var transactions = await query