store: scope workout kinds and their pace/HR ranges to a user_id
workout_kinds gains a real user_id column (Task 1); workout_type_paces has none of its own and is scoped via a join to workout_kinds instead, since it's always accessed through a specific kind. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,12 @@ func TestWorkoutTypePaces_SeededOnePerKindThenUpdate(t *testing.T) {
|
||||
db := openTestDB(t)
|
||||
ctx := context.Background()
|
||||
|
||||
all, err := db.ListWorkoutTypePaces(ctx)
|
||||
userID, err := db.ProvisionUser(ctx, "test-sub", "Test")
|
||||
if err != nil {
|
||||
t.Fatalf("ProvisionUser: %v", err)
|
||||
}
|
||||
|
||||
all, err := db.ListWorkoutTypePaces(ctx, userID)
|
||||
if err != nil {
|
||||
t.Fatalf("ListWorkoutTypePaces: %v", err)
|
||||
}
|
||||
@@ -29,11 +34,11 @@ func TestWorkoutTypePaces_SeededOnePerKindThenUpdate(t *testing.T) {
|
||||
target.HRMinPctHRR = &hrMin
|
||||
target.HRMaxPctHRR = &hrMax
|
||||
|
||||
if err := db.UpdateWorkoutTypePace(ctx, target); err != nil {
|
||||
if err := db.UpdateWorkoutTypePace(ctx, userID, target); err != nil {
|
||||
t.Fatalf("UpdateWorkoutTypePace: %v", err)
|
||||
}
|
||||
|
||||
got, err := db.GetWorkoutTypePace(ctx, target.WorkoutKindID)
|
||||
got, err := db.GetWorkoutTypePace(ctx, userID, target.WorkoutKindID)
|
||||
if err != nil {
|
||||
t.Fatalf("GetWorkoutTypePace: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user