fix(K): correct CATALOG_SCRIPT path + register AssetLibrary in models/__init__
- fix(tasks): use RENDER_SCRIPTS_DIR env var for catalog_assets.py path (was computing wrong path via __file__ parents → /render-worker/scripts/ which doesn't exist in container) - fix(models): add AssetLibrary to app/models/__init__.py so alembic autogenerate discovers it - fix(api): remove unused FileResponse import from asset_libraries.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import shutil
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File, Form, status
|
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File, Form, status
|
||||||
from fastapi.responses import FileResponse
|
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import uuid
|
import uuid
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -11,7 +12,8 @@ from celery import shared_task
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
CATALOG_SCRIPT = Path(__file__).parent.parent.parent.parent.parent / "render-worker" / "scripts" / "catalog_assets.py"
|
# Scripts are copied to /render-scripts/ in the render-worker container (RENDER_SCRIPTS_DIR env var)
|
||||||
|
CATALOG_SCRIPT = Path(os.environ.get("RENDER_SCRIPTS_DIR", "/render-scripts")) / "catalog_assets.py"
|
||||||
|
|
||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
@@ -48,7 +50,6 @@ def refresh_asset_library_catalog(self, asset_library_id: str) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Determine Blender binary
|
# Determine Blender binary
|
||||||
import os
|
|
||||||
blender_bin = os.environ.get("BLENDER_BIN", "blender")
|
blender_bin = os.environ.get("BLENDER_BIN", "blender")
|
||||||
|
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from app.domains.orders.models import Order, OrderItem, OrderLine
|
|||||||
from app.domains.notifications.models import AuditLog
|
from app.domains.notifications.models import AuditLog
|
||||||
from app.domains.billing.models import PricingTier
|
from app.domains.billing.models import PricingTier
|
||||||
from app.domains.rendering.models import OutputType, RenderTemplate, ProductRenderPosition, WorkflowDefinition, WorkflowRun, WorkflowNodeResult
|
from app.domains.rendering.models import OutputType, RenderTemplate, ProductRenderPosition, WorkflowDefinition, WorkflowRun, WorkflowNodeResult
|
||||||
from app.domains.materials.models import Material, MaterialAlias
|
from app.domains.materials.models import Material, MaterialAlias, AssetLibrary
|
||||||
from app.domains.media.models import MediaAsset, MediaAssetType
|
from app.domains.media.models import MediaAsset, MediaAssetType
|
||||||
|
|
||||||
# Also re-export SystemSetting (no domain assigned — stays as-is)
|
# Also re-export SystemSetting (no domain assigned — stays as-is)
|
||||||
@@ -21,5 +21,5 @@ __all__ = [
|
|||||||
"Tenant", "User", "Template", "CadFile", "Product", "Order", "OrderItem", "OrderLine",
|
"Tenant", "User", "Template", "CadFile", "Product", "Order", "OrderItem", "OrderLine",
|
||||||
"AuditLog", "PricingTier", "OutputType", "RenderTemplate", "ProductRenderPosition",
|
"AuditLog", "PricingTier", "OutputType", "RenderTemplate", "ProductRenderPosition",
|
||||||
"WorkflowDefinition", "WorkflowRun", "WorkflowNodeResult",
|
"WorkflowDefinition", "WorkflowRun", "WorkflowNodeResult",
|
||||||
"Material", "MaterialAlias", "MediaAsset", "MediaAssetType", "SystemSetting",
|
"Material", "MaterialAlias", "AssetLibrary", "MediaAsset", "MediaAssetType", "SystemSetting",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user