feat(backend): products and categories point at the media library (platform-v2 step 5.2)

- products.media_id / categories.media_id (Alembic 0027): the old
  /static/product_images photos are processed into the library (named after
  their product; missing or unreadable files logged and skipped; the old
  folder is left on disk) and products.image_url goes. The static mount is gone.
- APIs give `image` {id, name, thumb, card, full}; a product's image_url is its
  card size. media_id on create/update (null clears); media.not_a_picture for
  a video. POST /api/products/{id}/image is gone: uploads go to /api/media.
- Products and categories register their media usage: a photo in use can't
  be deleted.
- Media: AVIF pictures (Pillow 12.3), GET /api/media/{id} gives each stored
  size's bytes and resolution and the uploader's name; upload processing moved
  into services/media.ingest (also used by the data move).
- QR menu photo push (contract C-3): the library's card size, WebP.
- tests: test_product_photos.py (7, incl. the 0027 data move); 497 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 15:57:50 +02:00
co-authored by Claude Opus 5.5
parent 238f8ec5a0
commit 5ad4c4ef55
15 changed files with 398 additions and 99 deletions
+3 -2
View File
@@ -129,11 +129,12 @@
},
"media": {
"not_found": "File {{media_id}} isn't in the media library.",
"type": "Upload a picture (JPG, PNG, WebP or GIF) or a video (MP4 or WebM).",
"type": "Upload a picture (JPG, PNG, WebP, AVIF or GIF) or a video (MP4 or WebM).",
"too_big": "The file is too big (at most {{max_mb}} MB).",
"too_many_pixels": "The picture is too large (at most {{max_mp}} megapixels).",
"unreadable": "This picture can't be read. Save it again as JPG or PNG and upload it.",
"in_use": "This file is used by {{uses}}. Remove it there first."
"in_use": "This file is used by {{uses}}. Remove it there first.",
"not_a_picture": "Pick a picture here, not a video."
},
"caller_id": {
"key_invalid": "The phone system's key is missing or wrong."