Reformatting everything with black
This commit is contained in:
1 parent
7bd07f084a
commit
8185f1f8b3
48 files changed
+1000
-348
No files matched your search
+21
-6
@@ -34,7 +34,10 @@ async def create_scope_model(
|
||||
url=str(payload.url) if payload.url else None,
|
||||
)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="create", resource_type="ScopeModel",
|
||||
db,
|
||||
actor=actor,
|
||||
action="create",
|
||||
resource_type="ScopeModel",
|
||||
resource_id=sm.id,
|
||||
description=audit_crud.describe_create("ScopeModel", sm.id, sm.name),
|
||||
)
|
||||
@@ -49,7 +52,9 @@ async def get_scope_model(
|
||||
):
|
||||
sm = await scope_model_crud.get(db, scope_model_id)
|
||||
if sm is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found"
|
||||
)
|
||||
return sm
|
||||
|
||||
|
||||
@@ -62,13 +67,18 @@ async def update_scope_model(
|
||||
):
|
||||
sm = await scope_model_crud.get(db, scope_model_id)
|
||||
if sm is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found"
|
||||
)
|
||||
data = payload.model_dump(exclude_unset=True)
|
||||
if "url" in data and data["url"] is not None:
|
||||
data["url"] = str(data["url"])
|
||||
sm = await scope_model_crud.update(db, sm, data)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="update", resource_type="ScopeModel",
|
||||
db,
|
||||
actor=actor,
|
||||
action="update",
|
||||
resource_type="ScopeModel",
|
||||
resource_id=sm.id,
|
||||
description=audit_crud.describe_update("ScopeModel", sm.id, data),
|
||||
)
|
||||
@@ -83,11 +93,16 @@ async def delete_scope_model(
|
||||
):
|
||||
sm = await scope_model_crud.get(db, scope_model_id)
|
||||
if sm is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Scope model not found"
|
||||
)
|
||||
name = sm.name
|
||||
await scope_model_crud.delete(db, sm)
|
||||
await audit_crud.log(
|
||||
db, actor=actor, action="delete", resource_type="ScopeModel",
|
||||
db,
|
||||
actor=actor,
|
||||
action="delete",
|
||||
resource_type="ScopeModel",
|
||||
resource_id=scope_model_id,
|
||||
description=audit_crud.describe_delete("ScopeModel", scope_model_id, name),
|
||||
)
|
||||
Reference in new issue
Block a user