mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
Three batch-ingest routes ran a per-entry findUnique/upsert loop — up to 1000 sequential round trips on a 500-entry batch. - nutrients/batch: one indexed findMany existence read splits the batch into a bulk createMany (new day/nutrient pairs) and a $transaction of per-row updates (existing pairs), the shape measurements/batch already uses. A write failure now marks its whole group skipped rather than one entry, documented at the call site; validation failures stay isolated per entry as before. - mood-entries/bulk: the per-entry findUnique probe is replaced by one batched findMany keyed exactly like each entry's own dedup contract (externalId when carried, else date+moodLoggedAt). The per-entry upsert, tombstone check, tag-link writes and reverse push are unchanged — only the existence read is batched.