This commit is contained in:
xds
2026-03-22 14:26:45 +03:00
parent 33694d68db
commit 466a27907a
28 changed files with 1334 additions and 71 deletions

View File

@@ -37,6 +37,8 @@ async def calculate(
layer_height_mm: float = Form(0.2),
quantity: int = Form(1),
post_processing: str = Form(""),
color: str = Form(""),
multicolor: bool = Form(False),
db: AsyncSession = Depends(get_db),
):
logger.info("===== /api/calculate request =====")
@@ -51,8 +53,8 @@ async def calculate(
raise HTTPException(400, f"Неподдерживаемый формат файла. Допустимые: {', '.join(SUPPORTED_EXTENSIONS)}")
# Validate params
logger.info("Params: material_id=%d, infill=%d%%, layer=%.2fmm, qty=%d, post_processing='%s'",
material_id, infill_percent, layer_height_mm, quantity, post_processing)
logger.info("Params: material_id=%d, infill=%d%%, layer=%.2fmm, qty=%d, color='%s', multicolor=%s, post_processing='%s'",
material_id, infill_percent, layer_height_mm, quantity, color, multicolor, post_processing)
if not 10 <= infill_percent <= 100:
logger.warning("Invalid infill_percent: %d", infill_percent)
@@ -134,6 +136,7 @@ async def calculate(
layer_height_mm=layer_height_mm,
quantity=quantity,
post_processing=pp_list,
multicolor=multicolor,
)
# Save calculation to DB