fix(export): export all 14 tables, not just weights - #4
Conversation
Data export only fetched /api/weights and dumped that single table. Schema has 14 tables total; 13 were missing from any export path (goals, entries, dailySteps, workouts, settings, dailySleep, restingHeartRate, workoutRoutes, bodyComposition, vo2max, heartRateVariability, nutritionSprints, foodEntries). Added a dedicated /api/export route that does a plain unfiltered select per table (matching the query style of the existing per-table GET endpoints) rather than reusing endpoints like /api/vo2max or /api/hrv, which apply date-window filtering and response reshaping for their own UI purposes and would produce an incomplete/derived backup. Wired settings-modal's handleExportData to the new endpoint; same client-side blob-download behavior as before.
|
Warning Review limit reached
Next review available in: 39 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
/api/weightsand dumped just that one table — 13 of 14 tables were completely absent from any export path.GET /api/export, which does a plain, unfiltereddb.select().from(table)per table (mirroring the query style already used by the simple per-table GET routes) and returns one JSON object keyed by table name./api/vo2max,/api/hrv,/api/nutrition-sprints, or/api/food-entriesas-is for the export, since those endpoints apply date-window filtering, response reshaping, or (for nutrition-sprints) a side-effecting write — none of which belong in a full-data backup.settings-modal.tsx'shandleExportDatato call/api/exportinstead of/api/weights; same client-side blob-download UX as before (JSON file, same filename pattern).Tables now included: weights, goals, entries, dailySteps, workouts, settings, dailySleep, restingHeartRate, workoutRoutes, bodyComposition, vo2max, heartRateVariability, nutritionSprints, foodEntries (14/14).
Verification
npx tsc --noEmit— zero errors (installed deps with--ignore-scriptsfor typecheck only;node_modulesremoved after, not committed).better-sqlite3's native binding does not build against this machine's Node 26 — a known pre-existing blocker, unrelated to this change. Verified by code reading + typecheck only.Test plan
npm installon a machine where better-sqlite3 builds, run dev server, click Settings → Export Data, confirm the downloaded JSON has all 14 keys with expected row countsworkoutRoutes[].routeDatais still the raw JSON string (unparsed, same as stored) andsettingsreturns all rows (not just one key)🤖 Generated with Claude Code