Skip to content

armgit / lyftr

Public Imported from GitHub
0

Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.

Tidy exercise catalog comments and drop an unused error (#210)

Carterc5a8acb563af
diff --git a/CLAUDE.md b/CLAUDE.md
index 7fd1f4d..a81f63b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -38,7 +38,7 @@ backend/
middleware/auth.go — JWT validation middleware
models/models.go — all structs + request types
routes/routes.go — all routes, protected vs public
- stores/exercise.go — exercise store, incl. free-exercise-db seeding
+ stores/exercise.go — exercise store: local cache of oedb rows + scheduled sync
seed/users.go — demo user seeding (see also seed/demo_data.go)
utils/response.go — utils.OK / utils.BadRequest helpers
@@ -252,7 +252,7 @@ answering 502 must not evict anyone.
- `User` → `UserSettings` (calorie/macro targets, weight unit)
- `Workout` → `WorkoutExercise[]` → `Set[]`
- `Program` → `ProgramExercise[]` → `ProgramSet[]` (target reps/weight)
-- `Exercise` (seeded, 800+, shared across users)
+- `Exercise` (cached from oedb, 800+, shared across users; names/instructions per language in `exercise_translations`)
- `FoodLog` (meal, macros, per day)
- `WeightLog` (bodyweight over time)
diff --git a/backend/oedb/client.go b/backend/oedb/client.go
index 4fe7600..6bf4941 100644
--- a/backend/oedb/client.go
+++ b/backend/oedb/client.go
@@ -4,8 +4,9 @@
// Lyftr queries oedb rather than mirroring it. The local exercises table still
// exists, but as the rows a user has actually seen — see
// stores.ExerciseStore.Materialize — which a daily pass keeps current in every
-// catalog language, and not as a copy of the catalog. Search, filtering and ordering are answered upstream, so the
-// data Lyftr shows improves when oedb improves, without a redeploy.
+// catalog language, and not as a copy of the catalog. Search, filtering and
+// ordering are answered upstream, so the data Lyftr shows improves when oedb
+// improves, without a redeploy.
//
// The cache here is what makes that affordable. oedb serves list and detail reads
// with `Cache-Control: public, max-age=300, stale-while-revalidate=86400` plus an
diff --git a/backend/stores/exercise.go b/backend/stores/exercise.go
index 17f37f3..cb028be 100644
--- a/backend/stores/exercise.go
+++ b/backend/stores/exercise.go
@@ -16,8 +16,9 @@ import (
"github.com/Cawlumm/lyftr-backend/utils"
)
-// ExerciseStore owns all SQL for the (global, read-only) exercises catalog, and
-// wraps the seed subsystem for the admin sync/reset endpoints.
+// ExerciseStore owns all SQL for the (global, read-only) exercises catalog: the
+// local cache of oedb rows, the scheduled sync that fills it, and the admin
+// refresh/reset endpoints.
type ExerciseStore struct {
db *sql.DB
catalog *oedb.Client
@@ -562,9 +563,6 @@ func (s *ExerciseStore) fetchCatalog(ctx context.Context, f ExerciseFilter) ([]o
}
}
-// with no upstream configured.
-var errNoCatalog = errors.New("This server has no exercise catalog configured.")
-
// ErrNoCatalog is returned by the cache-management operations on an instance with
// no upstream configured.
var ErrNoCatalog = errors.New("This server has no exercise catalog configured.")