mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
refactor(workouts): move the batch ingest out of its route
postBatch was a 700-line function. The route keeps authentication, the per-account preference read, the body caps, the rate limit, the parse and the bridge-source refusal; the ingest moves verbatim into lib/workouts/batch-ingest/: the first pass (entries), the duplicate probe and write plan with the manual-correction rules (plan), the transaction that writes corrections, workouts, tracks and series (write), and the orchestrator with the audit, record detection, wide event, cache and arrivals (ingest). The route is 275 lines. The parity walk recorded before the move is unchanged; the guards that name the track writer, the Workout writer set and the per-entry external-id check point at the service files.
This commit is contained in:
1 parent
dd52a8d92a
commit
899b86f4d4
9 files changed
+909
-699
No files matched your search
@@ -178,7 +178,7 @@ export const createWorkoutSchema = z
|
||||
// The only writer of this schema is the batch ingest, which enforces
|
||||
// external-id stability per entry rather than at the field: a
|
||||
// schema-level refusal would fail the whole batch on one bad row.
|
||||
// @external-id-checked-per-entry: src/app/api/workouts/batch/route.ts
|
||||
// @external-id-checked-per-entry: src/lib/workouts/batch-ingest/entries.ts
|
||||
externalId: z.string().max(128).optional(),
|
||||
externalSourceVersion: z.string().max(64).optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
|
||||
Reference in new issue
Block a user