v1.0.0:5 — remove caloriesBurned raw-SQL workaround

The three exported helpers in lib/prisma.ts (getCaloriesBurned,
setCaloriesBurned, getCaloriesBurnedBulk) existed because an early
Prisma client generation didn't include the column. Schema and
client have been aligned for several releases — the workaround is
dead weight.

Removed: the helpers from lib/prisma.ts (~30 lines of
$queryRawUnsafe / $executeRawUnsafe).

Updated callers to use plain caloriesBurned field references:
- app/api/workouts/route.ts (GET list + POST create)
- app/api/workouts/[id]/route.ts (GET detail + PATCH update)
- app/api/settings/export-csv/route.ts (CSV export)

All call sites now go through normal type-safe Prisma queries.
Net effect for users: zero. Net effect for the codebase: cleaner
read paths, stronger TS coverage on caloriesBurned, fewer SQL
strings to audit.

No schema changes, no migration. Existing /data is untouched.

v1.0.0:5 promoted to current; :1, :2, :3, :4 in other.
This commit is contained in:
Keysat
2026-05-09 19:42:45 -05:00
parent 5f7b3b6b7a
commit dc6a3b1116
6 changed files with 54 additions and 98 deletions
+31
View File
@@ -0,0 +1,31 @@
import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk'
/**
* v1.0.0:5 — internal cleanup, no user-facing change.
*
* Removes the `caloriesBurned` raw-SQL workaround from lib/prisma.ts.
* That workaround was a vestige of an early Prisma client generation
* that didn't include the column; schema and client have been aligned
* for several releases. The three exported helpers
* (getCaloriesBurned, setCaloriesBurned, getCaloriesBurnedBulk) and
* every caller now use normal type-safe Prisma queries.
*
* Net effect for users: zero. Net effect for the codebase: ~30 lines
* of $queryRawUnsafe / $executeRawUnsafe deleted, three call sites
* (workouts list, workout detail GET/PATCH, settings/export-csv)
* simplified to plain `caloriesBurned` field references with full
* TS type checking.
*
* No schema changes, no migration, no config changes.
*/
export const v_1_0_0_5 = VersionInfo.of({
version: '1.0.0:5',
releaseNotes: {
en_US:
'Internal cleanup: removes the legacy caloriesBurned raw-SQL workaround from lib/prisma.ts and switches every caller to type-safe Prisma queries. No user-facing changes; no migration; existing /data is untouched.',
},
migrations: {
up: async () => {},
down: IMPOSSIBLE,
},
})