fix: render pipeline + multi-tenancy bugs (B-Fix-1 through B-Fix-9)

- Remove worker-thumbnail (no Blender, was competing on thumbnail_rendering)
- Move render_order_line_task to thumbnail_rendering queue (render-worker)
- Restore template_service.py real implementation (fix circular import shim)
- Thread tenant_id through STEP upload, Excel import, product create
- Make system tables (output_types, materials, etc.) tenant_id nullable
- Fix tenants frontend 307-redirect: use trailing slash /tenants/
- Remove Flamenco + Three.js from Admin UI (unsupported)
- Set all output_types render_backend to celery (was flamenco)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 19:34:20 +01:00
parent 381f44bc8b
commit ab3f9c734a
14 changed files with 149 additions and 369 deletions
+6
View File
@@ -345,6 +345,7 @@ async def create_order(
created_by=user.id,
source_excel=body.source_excel,
notes=body.notes,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(order)
await db.flush()
@@ -364,6 +365,7 @@ async def create_order(
lagertyp=item_data.lagertyp,
medias_rendering=item_data.medias_rendering,
components=[c.model_dump() for c in item_data.components],
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(item)
@@ -381,6 +383,7 @@ async def create_order(
render_position_id=line_data.render_position_id,
gewuenschte_bildnummer=line_data.gewuenschte_bildnummer,
notes=line_data.notes,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(line)
@@ -565,6 +568,7 @@ async def split_missing_step(
created_by=order.created_by,
source_excel=order.source_excel,
notes=f"Split from {order.order_number} — awaiting STEP files",
tenant_id=order.tenant_id,
)
db.add(new_order)
await db.flush()
@@ -665,6 +669,7 @@ async def generate_lines_from_items(
product_id=product.id,
output_type_id=type_id,
gewuenschte_bildnummer=item.gewuenschte_bildnummer,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(line)
existing_pairs.add(pair)
@@ -807,6 +812,7 @@ async def add_order_line(
render_position_id=body.render_position_id,
gewuenschte_bildnummer=body.gewuenschte_bildnummer,
notes=body.notes,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(line)
try:
+1 -1
View File
@@ -206,7 +206,7 @@ async def create_product(
raise HTTPException(409, detail=f"Product with pim_id '{body.pim_id}' already exists")
from app.services.product_service import create_default_positions
product = Product(**body.model_dump())
product = Product(**body.model_dump(), tenant_id=getattr(user, 'tenant_id', None))
db.add(product)
await db.flush()
await create_default_positions(db, product.id)
+6
View File
@@ -241,6 +241,7 @@ async def finalize_excel(
included_rows,
source_excel=str(excel_path),
category_key=parsed_dict.get("category_key"),
tenant_id=getattr(user, 'tenant_id', None),
)
# 5. Seed material aliases
@@ -260,6 +261,7 @@ async def finalize_excel(
created_by=user.id,
source_excel=str(excel_path),
notes=body.notes,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(order)
await db.flush()
@@ -292,6 +294,7 @@ async def finalize_excel(
for c in row.get("components", [])
],
cad_file_id=inherited_cad,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(item)
@@ -316,6 +319,7 @@ async def finalize_excel(
product_id=uuid.UUID(product_id),
output_type_id=None,
gewuenschte_bildnummer=row.get("gewuenschte_bildnummer"),
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(line)
else:
@@ -325,6 +329,7 @@ async def finalize_excel(
product_id=uuid.UUID(product_id),
output_type_id=type_id,
gewuenschte_bildnummer=row.get("gewuenschte_bildnummer"),
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(line)
@@ -410,6 +415,7 @@ async def upload_step(
file_hash=file_hash,
file_size=len(content),
processing_status=ProcessingStatus.pending,
tenant_id=getattr(user, 'tenant_id', None),
)
db.add(cad_file)
await db.commit()