feat: layout hamburger, media browser filters+previews, billing fixes
- Layout: mobile hamburger menu + overlay backdrop + close button; content area always full-width - Media browser: filter chips (default still+turntable); advanced toggle for GLB/STL; thumbnail_url previews for non-image types; video hover-play for turntable - Backend: asset_types multi-filter, thumbnail_url in MediaAssetOut, download proxy endpoint for MinIO/local files - Admin: "Import Existing Media" button → POST /api/admin/import-media-assets - Billing: fix invoice create 500 (MissingGreenlet — use selectinload after commit); PDF download uses axios blob instead of bare <a href> (auth header missing); fix storage.upload() accepting str|Path - SSE task logs: task_logs.py core + router, LiveRenderLog component - CadPreview: fix infinite loop when no gltf_geometry assets; loading screen before ThreeDViewer render - render-worker: add trimesh layer to Dockerfile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
import uuid
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.responses import Response
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database import get_db
|
||||
@@ -83,8 +83,12 @@ async def download_invoice_pdf(
|
||||
if not key:
|
||||
raise HTTPException(status_code=503, detail="PDF generation unavailable (WeasyPrint not installed)")
|
||||
from app.core.storage import get_storage
|
||||
url = get_storage().get_url(key)
|
||||
return RedirectResponse(url=url)
|
||||
pdf_bytes = get_storage().download_bytes(key)
|
||||
return Response(
|
||||
content=pdf_bytes,
|
||||
media_type="application/pdf",
|
||||
headers={"Content-Disposition": f"attachment; filename=invoice-{invoice_id}.pdf"},
|
||||
)
|
||||
|
||||
|
||||
@invoice_router.delete("/invoices/{invoice_id}", status_code=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import uuid
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, computed_field
|
||||
|
||||
|
||||
class InvoiceLineCreate(BaseModel):
|
||||
@@ -54,4 +54,11 @@ class InvoiceOut(BaseModel):
|
||||
created_at: datetime
|
||||
lines: list[InvoiceLineOut] = []
|
||||
|
||||
@computed_field # type: ignore[misc]
|
||||
@property
|
||||
def pdf_url(self) -> str | None:
|
||||
if self.pdf_key:
|
||||
return f"/api/billing/invoices/{self.id}/pdf"
|
||||
return None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
@@ -267,8 +267,7 @@ async def create_invoice(
|
||||
invoice.total_net = total_net
|
||||
invoice.total_vat = (total_net * vat_rate).quantize(Decimal("0.01"))
|
||||
await db.commit()
|
||||
await db.refresh(invoice)
|
||||
return invoice
|
||||
return await get_invoice(db, invoice.id)
|
||||
|
||||
|
||||
async def get_invoices(
|
||||
|
||||
Reference in New Issue
Block a user