Tag writes: bulk endpoint, and fix remove/re-add/duplicate bugs #201

Merged
cameron merged 1 commits from feat/bulk-tags into master 2026-11-01 18:05:46 +00:00
1 Commits
Author SHA1 Message Date
Cameron CordesandClaude Opus 5.5 96a2858a50 Tag writes: POST /image/tags/bulk, and fix remove/re-add/duplicate bugs
- POST /image/tags/bulk { file_names, add: [names], remove: [ids] }: one
  transaction over many photos; names match case-insensitively and are
  created when missing; 400 if a tag is both added and removed.
- Adding a tag a photo already has is a no-op (was a 500 on
  UNIQUE(rel_path, tag_id)).
- Adding a tag no photo carries reuses it (the lookup only saw tags in
  use, so create_tag hit idx_tags_name_nocase: 500). update_tags could
  likewise skip such ids silently.
- Removing a tag matches the name case-insensitively and deletes it from
  every path sharing the photo's content, as reads union them; it used to
  answer 200 and leave the tag on the other copy.
- update_tags returns errors instead of panicking with the TagDao lock
  held, which poisoned it for every later tag request.

Closes #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:49:31 -05:00