store: scope GetProfile/UpdateProfile to a user_id

Part of per-user profile isolation: profile rows are no longer a global
singleton, so every read/write requires the caller's userID. This also
requires scoping ListActivities, ListWorkoutKinds, UpsertActivity,
CreateWorkoutKind, GetSyncState, UpdateSyncState, and ResetAllSyncedData
to userID, plus updating all related tests in the store package.
This commit is contained in:
2026-07-25 13:17:17 +02:00
parent b0a7462ebe
commit ef410863c6
10 changed files with 104 additions and 67 deletions

View File

@@ -8,8 +8,12 @@ import (
func TestWorkoutTaxonomy_SeededWithEightFixedTypes(t *testing.T) {
db := openTestDB(t)
ctx := context.Background()
userID, err := db.ProvisionUser(ctx, "test-sub", "Test User")
if err != nil {
t.Fatalf("ProvisionUser: %v", err)
}
kinds, err := db.ListWorkoutKinds(ctx, true)
kinds, err := db.ListWorkoutKinds(ctx, userID, true)
if err != nil {
t.Fatalf("ListWorkoutKinds: %v", err)
}
@@ -42,8 +46,12 @@ func TestWorkoutTaxonomy_SeededWithEightFixedTypes(t *testing.T) {
func TestWorkoutTaxonomy_ListedInFixedDisplayOrder(t *testing.T) {
db := openTestDB(t)
ctx := context.Background()
userID, err := db.ProvisionUser(ctx, "test-sub", "Test User")
if err != nil {
t.Fatalf("ProvisionUser: %v", err)
}
kinds, err := db.ListWorkoutKinds(ctx, true)
kinds, err := db.ListWorkoutKinds(ctx, userID, true)
if err != nil {
t.Fatalf("ListWorkoutKinds: %v", err)
}