Adding Manual connection point to allow undeclared fits
This commit is contained in:
1 parent
7e246be39c
commit
b4dcb68bea
15 files changed
+227
-23
No files matched your search
@@ -27,7 +27,7 @@ def _connection_label(ap) -> str:
|
||||
return f"{cc.min_in}–{cc.max_in} in"
|
||||
if ap.static_connection:
|
||||
return f"{ap.static_connection.od_mm} mm OD"
|
||||
return "—"
|
||||
return "Manual"
|
||||
|
||||
|
||||
@router.get("", response_model=list[AttachmentPointRead])
|
||||
@@ -54,10 +54,14 @@ async def create_attachment_point(
|
||||
payload.clamp_connection_id,
|
||||
payload.static_connection_id,
|
||||
]
|
||||
if sum(v is not None for v in conn_ids) != 1:
|
||||
if sum(v is not None for v in conn_ids) > 1:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="Exactly one connection (iso_thread, unc_thread, clamp_connection, or static_connection) must be provided.",
|
||||
detail=(
|
||||
"At most one connection (iso_thread, unc_thread, clamp_connection, "
|
||||
"or static_connection) may be provided. Leave all unset for a "
|
||||
"manual attachment point."
|
||||
),
|
||||
)
|
||||
ap = await attachment_point_crud.create(db, **payload.model_dump())
|
||||
await audit_crud.log(
|
||||
|
||||
Reference in new issue
Block a user