mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
Thread the acting user id through createTagLinks, replaceTagLinks, and replaceRatedFactorLinks, and assert the target MoodEntry belongs to that user before writing any link. The check runs against the same client (tx or singleton) as the write, so it shares one snapshot. Behaviour is unchanged for the existing POST and bulk paths, where the entry is freshly created and owned; the guard closes a latent cross-user link hazard for the planned PATCH mood-edit route. A mismatched or missing entry throws MoodEntryOwnershipError before any catalog or join touch. Add IF NOT EXISTS to every ADD COLUMN in migration 0119 so a clean replay is idempotent, matching the 0117 convention. (cherry picked from commit 1bf983f6c2c5e44796c99983d57c1b1d90cd7099)