From 7855ce762d59cfaadf91fd58cd599a7c5a371dc0 Mon Sep 17 00:00:00 2001 From: Ehan A Date: Wed, 15 Jul 2026 23:24:35 -0400 Subject: [PATCH 1/3] Fix PT null user id when getting studyset ids --- graph/resolver/mutation.resolvers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graph/resolver/mutation.resolvers.go b/graph/resolver/mutation.resolvers.go index 8978b35..87ab0f6 100644 --- a/graph/resolver/mutation.resolvers.go +++ b/graph/resolver/mutation.resolvers.go @@ -646,10 +646,10 @@ func (r *mutationResolver) RecordPracticeTest(ctx context.Context, input model.P var studysetIDs []string if len(allTermIDs) > 0 { var studysets []struct { - ID string `db:"id"` - Private bool `db:"private"` - UserID string `db:"user_id"` - Draft bool `db:"draft"` + ID string `db:"id"` + Private bool `db:"private"` + UserID *string `db:"user_id"` + Draft bool `db:"draft"` } err = pgxscan.Select(ctx, tx, &studysets, ` SELECT id, private, user_id, draft @@ -661,7 +661,7 @@ func (r *mutationResolver) RecordPracticeTest(ctx context.Context, input model.P } for _, s := range studysets { - if s.Draft || (s.Private && (authedUser.ID == nil || s.UserID != *authedUser.ID)) { + if s.Draft || (s.Private && (s.UserID == nil || authedUser.ID == nil || *s.UserID != *authedUser.ID)) { return nil, fmt.Errorf("studyset not found or not accessible") } studysetIDs = append(studysetIDs, s.ID) From fa9f0872cb114a5a230b5a786e2363608b46aab0 Mon Sep 17 00:00:00 2001 From: Ehan A Date: Wed, 15 Jul 2026 23:34:21 -0400 Subject: [PATCH 2/3] better --- graph/resolver/mutation.resolvers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graph/resolver/mutation.resolvers.go b/graph/resolver/mutation.resolvers.go index 87ab0f6..ac24c59 100644 --- a/graph/resolver/mutation.resolvers.go +++ b/graph/resolver/mutation.resolvers.go @@ -661,8 +661,9 @@ func (r *mutationResolver) RecordPracticeTest(ctx context.Context, input model.P } for _, s := range studysets { - if s.Draft || (s.Private && (s.UserID == nil || authedUser.ID == nil || *s.UserID != *authedUser.ID)) { - return nil, fmt.Errorf("studyset not found or not accessible") + // if s.Draft || (s.Private && (s.UserID == nil || authedUser.ID == nil || *s.UserID != *authedUser.ID)) { + if s.Draft { + continue } studysetIDs = append(studysetIDs, s.ID) } From 7af371af3560a1b1f9b40399670914a69e739a80 Mon Sep 17 00:00:00 2001 From: Ehan A Date: Wed, 15 Jul 2026 23:35:14 -0400 Subject: [PATCH 3/3] format i think --- graph/resolver/studyset.resolvers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graph/resolver/studyset.resolvers.go b/graph/resolver/studyset.resolvers.go index 95686fd..47473d5 100644 --- a/graph/resolver/studyset.resolvers.go +++ b/graph/resolver/studyset.resolvers.go @@ -172,9 +172,9 @@ func (r *studysetResolver) AuthorFolder(ctx context.Context, obj *model.Studyset } var row struct { - ID *string `db:"id"` - Name *string `db:"name"` - UserID *string `db:"user_id"` + ID *string `db:"id"` + Name *string `db:"name"` + UserID *string `db:"user_id"` } sql := ` SELECT f.id, f.name, f.user_id FROM folders f