feat: push product images to cloud for the QR menu
local_backend now uploads each product's image file to cloud_backend during the existing ~5 min menu sync, so the QR menu can show real photos without needing a manually-set digital_image_url. Only re-uploads images whose content hash changed since the last push (Product.cloud_image_hash), to avoid re-sending unchanged binaries every cycle. Also adds a manual "sync now" trigger (POST /api/system/sync-menu) and a matching button in Settings → Operation, for pushing menu/price/image changes immediately instead of waiting for the next automatic cycle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ from models.user import User
|
||||
from models.product import Category, Product
|
||||
from models.table import Table, TableGroup
|
||||
from services import printer_service
|
||||
from services.cloud_sync import _sync_once
|
||||
from services.cloud_sync import _sync_once, _push_menu_snapshot
|
||||
from middleware.license_check import license_state
|
||||
from config import settings
|
||||
|
||||
@@ -106,6 +106,13 @@ async def sync_license_now(user: User = Depends(require_manager)):
|
||||
}
|
||||
|
||||
|
||||
@router.post("/sync-menu")
|
||||
async def sync_menu_now(user: User = Depends(require_manager)):
|
||||
"""Immediately push the digital menu snapshot (and any changed product images) to the cloud."""
|
||||
await _push_menu_snapshot()
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.get("/printers", response_model=List[PrinterOut])
|
||||
def list_printers(db: Session = Depends(get_db), user: User = Depends(require_manager)):
|
||||
return db.query(Printer).all()
|
||||
|
||||
Reference in New Issue
Block a user