diff --git a/backend/app/tasks/step_tasks.py b/backend/app/tasks/step_tasks.py index 25abcee..41314c7 100644 --- a/backend/app/tasks/step_tasks.py +++ b/backend/app/tasks/step_tasks.py @@ -644,6 +644,32 @@ def render_order_line_task(self, order_line_id: str): ) session.commit() + if success: + # Create MediaAsset so the render appears in the Media Browser + try: + from app.domains.media.models import MediaAsset, MediaAssetType as MAT + _ext = str(output_path).rsplit(".", 1)[-1].lower() if "." in str(output_path) else "bin" + _mime = "video/mp4" if _ext in ("mp4", "webm") else ("image/jpeg" if _ext in ("jpg", "jpeg") else "image/png") + _is_anim = bool(line.output_type and line.output_type.is_animation) + _at = MAT.turntable if _is_anim else MAT.still + _tenant_id = line.product.cad_file.tenant_id if (line.product and line.product.cad_file) else None + _existing = session.execute( + select(MediaAsset.id).where(MediaAsset.storage_key == output_path).limit(1) + ).scalar_one_or_none() + if not _existing: + _asset = MediaAsset( + tenant_id=_tenant_id, + order_line_id=line.id, + product_id=line.product_id, + asset_type=_at, + storage_key=output_path, + mime_type=_mime, + ) + session.add(_asset) + session.commit() + except Exception: + logger.exception("Failed to create MediaAsset for order_line %s", order_line_id) + if success: emit(order_line_id, f"Render completed in {elapsed:.1f}s", "success") else: diff --git a/frontend/src/pages/AssetLibrary.tsx b/frontend/src/pages/AssetLibrary.tsx index caca79c..a12d93e 100644 --- a/frontend/src/pages/AssetLibrary.tsx +++ b/frontend/src/pages/AssetLibrary.tsx @@ -273,7 +273,7 @@ export default function AssetLibraryPage() { }) return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/Billing.tsx b/frontend/src/pages/Billing.tsx index 4af6317..5ff7b85 100644 --- a/frontend/src/pages/Billing.tsx +++ b/frontend/src/pages/Billing.tsx @@ -125,7 +125,7 @@ export default function BillingPage() { const paidCount = invoices.filter(inv => inv.status === 'paid').length return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/Materials.tsx b/frontend/src/pages/Materials.tsx index 9014626..ba0a539 100644 --- a/frontend/src/pages/Materials.tsx +++ b/frontend/src/pages/Materials.tsx @@ -200,7 +200,7 @@ export default function MaterialsPage() { const totalAliases = materials.reduce((sum, m) => sum + m.aliases.length, 0) return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/MediaBrowser.tsx b/frontend/src/pages/MediaBrowser.tsx index dd28efc..3ac00e8 100644 --- a/frontend/src/pages/MediaBrowser.tsx +++ b/frontend/src/pages/MediaBrowser.tsx @@ -259,7 +259,7 @@ export default function MediaBrowserPage() { } return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/NewProductOrder.tsx b/frontend/src/pages/NewProductOrder.tsx index a4df66e..18a8df6 100644 --- a/frontend/src/pages/NewProductOrder.tsx +++ b/frontend/src/pages/NewProductOrder.tsx @@ -331,7 +331,7 @@ export default function NewProductOrderPage() { } return ( -
+
{/* Header */}
Back diff --git a/frontend/src/pages/OrderDetail.tsx b/frontend/src/pages/OrderDetail.tsx index 8a5c9b0..c89252f 100644 --- a/frontend/src/pages/OrderDetail.tsx +++ b/frontend/src/pages/OrderDetail.tsx @@ -204,7 +204,7 @@ export default function OrderDetailPage() { const activeFilterCount = countActiveFilters(filters) return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/ProductDetail.tsx b/frontend/src/pages/ProductDetail.tsx index db9f7d1..af8c181 100644 --- a/frontend/src/pages/ProductDetail.tsx +++ b/frontend/src/pages/ProductDetail.tsx @@ -311,7 +311,7 @@ export default function ProductDetailPage() { if (!product) return
Product not found
return ( -
+
{/* Back */} Products diff --git a/frontend/src/pages/Tenants.tsx b/frontend/src/pages/Tenants.tsx index fb56963..4eb4b2d 100644 --- a/frontend/src/pages/Tenants.tsx +++ b/frontend/src/pages/Tenants.tsx @@ -116,7 +116,7 @@ export default function TenantsPage() { } return ( -
+
{/* Header */}
diff --git a/frontend/src/pages/WorkerActivity.tsx b/frontend/src/pages/WorkerActivity.tsx index c0737b8..d779d79 100644 --- a/frontend/src/pages/WorkerActivity.tsx +++ b/frontend/src/pages/WorkerActivity.tsx @@ -61,7 +61,7 @@ export default function WorkerActivityPage() { const isEmpty = !isLoading && events.length === 0 return ( -
+

Worker Activity

diff --git a/frontend/src/pages/WorkerManagement.tsx b/frontend/src/pages/WorkerManagement.tsx index 11cbf9a..1b22025 100644 --- a/frontend/src/pages/WorkerManagement.tsx +++ b/frontend/src/pages/WorkerManagement.tsx @@ -189,7 +189,7 @@ export default function WorkerManagement() { const queueDepths = queueData?.queue_depths ?? {} return ( -
+
{/* Header */}