Reformatting everything with black
This commit is contained in:
1 parent
7bd07f084a
commit
8185f1f8b3
48 files changed
+1000
-348
No files matched your search
@@ -25,7 +25,9 @@ async def list_clamp_connections(
|
||||
return await clamp_connection_crud.list_all(db, skip=skip, limit=limit)
|
||||
|
||||
|
||||
@router.post("", response_model=ClampConnectionRead, status_code=status.HTTP_201_CREATED)
|
||||
@router.post(
|
||||
"", response_model=ClampConnectionRead, status_code=status.HTTP_201_CREATED
|
||||
)
|
||||
async def create_clamp_connection(
|
||||
payload: ClampConnectionCreate,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
@@ -39,11 +41,19 @@ async def create_clamp_connection(
|
||||
max_in=payload.max_in,
|
||||
)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="create", resource_type="ClampConnection",
|
||||
db,
|
||||
actor=actor,
|
||||
action="create",
|
||||
resource_type="ClampConnection",
|
||||
resource_id=cc.id,
|
||||
description=audit_crud.describe_create(
|
||||
"ClampConnection", cc.id,
|
||||
f"{cc.min_mm}–{cc.max_mm} mm" if cc.min_mm is not None else f"{cc.min_in}–{cc.max_in} in",
|
||||
"ClampConnection",
|
||||
cc.id,
|
||||
(
|
||||
f"{cc.min_mm}–{cc.max_mm} mm"
|
||||
if cc.min_mm is not None
|
||||
else f"{cc.min_in}–{cc.max_in} in"
|
||||
),
|
||||
),
|
||||
)
|
||||
return cc
|
||||
@@ -74,7 +84,10 @@ async def update_clamp_connection(
|
||||
changes = payload.model_dump(exclude_unset=True)
|
||||
cc = await clamp_connection_crud.update(db, cc, changes)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="update", resource_type="ClampConnection",
|
||||
db,
|
||||
actor=actor,
|
||||
action="update",
|
||||
resource_type="ClampConnection",
|
||||
resource_id=cc.id,
|
||||
description=audit_crud.describe_update("ClampConnection", cc.id, changes),
|
||||
)
|
||||
@@ -91,12 +104,18 @@ async def delete_clamp_connection(
|
||||
if cc is None:
|
||||
raise HTTPException(status_code=404, detail="Clamp connection not found")
|
||||
label = (
|
||||
f"{cc.min_mm}–{cc.max_mm} mm" if cc.min_mm is not None
|
||||
f"{cc.min_mm}–{cc.max_mm} mm"
|
||||
if cc.min_mm is not None
|
||||
else f"{cc.min_in}–{cc.max_in} in"
|
||||
)
|
||||
await clamp_connection_crud.delete(db, cc)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="delete", resource_type="ClampConnection",
|
||||
db,
|
||||
actor=actor,
|
||||
action="delete",
|
||||
resource_type="ClampConnection",
|
||||
resource_id=clamp_connection_id,
|
||||
description=audit_crud.describe_delete("ClampConnection", clamp_connection_id, label),
|
||||
description=audit_crud.describe_delete(
|
||||
"ClampConnection", clamp_connection_id, label
|
||||
),
|
||||
)
|
||||
Reference in new issue
Block a user