refactor(backend): drop the legacy products.printer_zone_id and its print fallbacks
Routing has been by prep zone only since v1, which nulled this column on every start, so the four fallbacks in printer_service.py never ran. Revision 0012 drops the column (its unnamed FK goes with the batch rebuild). The unused legacy GET /api/kds/items keeps its single 'no zone' group. Product create/update/export/import no longer mention it. Scheduled in plan step 1.0 for the catalogue rework (1.13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,6 @@ def _serialize_product(p: Product) -> dict:
|
||||
return {
|
||||
"name": p.name, "base_price": p.base_price, "is_available": p.is_available,
|
||||
"lifecycle_status": p.lifecycle_status, "sort_order": p.sort_order,
|
||||
"printer_zone_id": None, # always stripped on export
|
||||
"quick_options": quick_options, "options": options,
|
||||
"ingredients": ingredients, "preference_sets": preference_sets,
|
||||
}
|
||||
@@ -179,7 +178,6 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
|
||||
existing.lifecycle_status = prod_data.get("lifecycle_status", "active")
|
||||
existing.sort_order = prod_data.get("sort_order", 0)
|
||||
existing.category_id = category_id
|
||||
existing.printer_zone_id = None
|
||||
db.flush()
|
||||
product = existing
|
||||
else:
|
||||
@@ -190,7 +188,6 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
|
||||
lifecycle_status=prod_data.get("lifecycle_status", "active"),
|
||||
sort_order=prod_data.get("sort_order", 0),
|
||||
category_id=category_id,
|
||||
printer_zone_id=None,
|
||||
)
|
||||
db.add(product)
|
||||
db.flush()
|
||||
|
||||
@@ -771,7 +771,7 @@ def kds_items(
|
||||
|
||||
for item in items:
|
||||
product = item.product
|
||||
zone_id = product.printer_zone_id if product else None
|
||||
zone_id = None # legacy per-product printer is gone (routing is by prep zone); one group, as before
|
||||
zkey = _zone_key(zone_id)
|
||||
if zkey not in zones:
|
||||
zones[zkey] = {"zone_id": zone_id, "zone_name": _zone_name(zone_id), "items": []}
|
||||
|
||||
@@ -360,8 +360,6 @@ def update_product(product_id: int, body: ProductUpdate, db: Session = Depends(g
|
||||
)
|
||||
for field, value in scalar_fields.items():
|
||||
setattr(product, field, value)
|
||||
# Always clear legacy per-product printer — routing is now via prep zones only
|
||||
product.printer_zone_id = None
|
||||
# Update prep zones if provided
|
||||
if body.prep_zone_ids is not None:
|
||||
zones = db.query(PrepZone).filter(PrepZone.id.in_(body.prep_zone_ids)).all()
|
||||
|
||||
Reference in New Issue
Block a user