Subject: [PATCH links] Fix error fetching payment history

From: Peter Sanchez <[email-masked]>
Date: Sat, 28 Jun 2025 09:00:42 -0600

---
 api/graph/schema.resolvers.go | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index 956e692..e056216 100644
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -4945,13 +4945,13 @@ func (r *queryResolver) GetPaymentHistory(ctx context.Context, input *model.GetP
 				WithCode(valid.ErrNotFoundCode)
 			return nil, nil
 		}
+		org = orgs[0]
 
 		if !user.IsSuperUser() && !org.CanRead(ctx, user) {
 			validator.Error("%s", lt.Translate("This user is not allowed to perform this action")).
 				WithCode(valid.ErrNotFoundCode)
 			return nil, nil
 		}
-		org = orgs[0]
 	}
 
 	opts = &database.FilterOptions{
@@ -6618,28 +6618,28 @@ func (r *queryResolver) GetAuditLogs(ctx context.Context, input *model.AuditLogI
 		return nil, nil
 	}
 
-	var userId int
+	var userID int
 	if org == nil && !user.IsSuperUser() {
-		userId = int(user.ID)
+		userID = int(user.ID)
 	}
 
 	if input.UserID != nil && *input.UserID > 0 {
 		if user.IsSuperUser() {
-			userId = *input.UserID
+			userID = *input.UserID
 		} else if *input.UserID != int(user.ID) {
 			if org != nil {
 				// If the given user was never part of the organization, no records would be returned.
 				// However if a user is removed from an organization we still want to be able to
 				// view their audit logs
-				userId = *input.UserID
+				userID = *input.UserID
 			}
 		}
 	}
 
-	if userId > 0 {
+	if userID > 0 {
 		opts.Filter = sq.And{
 			opts.Filter,
-			sq.Eq{"al.user_id": userId},
+			sq.Eq{"al.user_id": userID},
 		}
 	}
 
-- 
2.49.0