refactor: Remove ICurrentUserService dependency from query handlers and update user ID handling logic
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 8s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 8s
This commit is contained in:
@@ -57,8 +57,11 @@ public class UserWalletService : UserWalletContract.UserWalletContractBase
|
||||
|
||||
public override async Task<GetCustomerWalletResponse> GetCustomerWallet(Google.Protobuf.WellKnownTypes.Empty request, ServerCallContext context)
|
||||
{
|
||||
// Use GetUserWallet with Id=0 to automatically use current user from JWT
|
||||
var walletQuery = new GetUserWalletQuery { Id = 0 };
|
||||
// Customer endpoint: resolve userId from JWT
|
||||
if (!long.TryParse(_currentUserService.UserId, out var userId) || userId <= 0)
|
||||
throw new RpcException(new Status(StatusCode.Unauthenticated, "کاربر احراز هویت نشده است"));
|
||||
|
||||
var walletQuery = new GetUserWalletQuery { Id = userId };
|
||||
var wallet = await _sender.Send(walletQuery, context.CancellationToken);
|
||||
|
||||
return new GetCustomerWalletResponse
|
||||
|
||||
Reference in New Issue
Block a user