feat(backend): customer display looks on the media library, one per display (platform-v2 step 5.3)
- display_looks (Alembic 0028): named idle screens, one default; config is
the 3.4 design with pictures as media library ids. 0028 turns the setting
customer_display.idle into the look "Main" and moves its data/display_media
pictures into the library (the old folder stays on disk).
- A display shows the look in its device config `look` (ref ConfigField,
choices_from "display_looks", validated in device_config) or the default.
- /api/display/looks (GET also for core.devices.manage), POST, PUT,
POST /{id}/default, DELETE (not the default; its displays go back to it);
/api/display/displays and PUT /displays/{id}/look. A change sends
display.settings only to the displays showing that look.
- /api/display/settings, /api/display/media* and their error codes are gone;
GET /api/display/state keeps its shape (logo card size, image/slides full).
- Looks register their media usage (a picture in a look can't be deleted).
- tests: test_customer_display.py (7, incl. two displays two slideshows and
the 0028 data move); 501 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,10 +94,10 @@ CODES: dict[str, tuple[int, str]] = {
|
||||
"online.not_found": (404, "Online order {order_id} not found."),
|
||||
"online.status_changed": (409, "This online order was changed on another screen in the meantime. Check where it is now."),
|
||||
"caller_id.key_invalid": (403, "The phone system's key is missing or wrong."),
|
||||
"display.media_unknown": (404, "Image {name} not found."),
|
||||
"display.media_type": (422, "Upload a JPG, PNG, WebP or GIF image."),
|
||||
"display.media_too_big": (413, "The image is too big (at most {max_mb} MB)."),
|
||||
"display.qr_url_missing": (422, "Enter the link the QR code opens."),
|
||||
"display.look_unknown": (404, "Look {look_id} not found."),
|
||||
"display.look_default": (409, "The default look can't be deleted. Make another look the default first."),
|
||||
"display.not_a_display": (404, "Device {device_id} isn't a customer display."),
|
||||
"media.not_found": (404, "File {media_id} isn't in the media library."),
|
||||
"media.type": (422, "Upload a picture (JPG, PNG, WebP, AVIF or GIF) or a video (MP4 or WebM)."),
|
||||
"media.too_big": (413, "The file is too big (at most {max_mb} MB)."),
|
||||
|
||||
@@ -52,6 +52,9 @@ def _ref_exists(source: str, value: int, db) -> bool:
|
||||
from models.printer import Printer
|
||||
p = db.get(Printer, value)
|
||||
return p is not None and bool(p.is_active)
|
||||
if source == "display_looks":
|
||||
from models.display_look import DisplayLook
|
||||
return db.get(DisplayLook, value) is not None
|
||||
if source.startswith("devices:"):
|
||||
from models.device import Device
|
||||
d = db.get(Device, value)
|
||||
|
||||
Reference in New Issue
Block a user