chore: fix all ruff lint errors + format — 0 errors, 306 tests pass
This commit is contained in:
+18
-6
@@ -4,8 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from fastapi import Response
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
@@ -37,7 +36,11 @@ async def create_role(
|
||||
"""Create a custom role (admin only)."""
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
role = await role_service.create_role(
|
||||
db, tenant_id, body.name, body.permissions, body.field_permissions,
|
||||
db,
|
||||
tenant_id,
|
||||
body.name,
|
||||
body.permissions,
|
||||
body.field_permissions,
|
||||
)
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
@@ -62,10 +65,17 @@ async def update_role(
|
||||
try:
|
||||
rid = uuid.UUID(role_id)
|
||||
except ValueError:
|
||||
raise HTTPException(400, detail={"detail": "Invalid role_id", "code": "invalid_id"})
|
||||
raise HTTPException(
|
||||
400, detail={"detail": "Invalid role_id", "code": "invalid_id"}
|
||||
) from None
|
||||
|
||||
role = await role_service.update_role(
|
||||
db, tenant_id, rid, body.name, body.permissions, body.field_permissions,
|
||||
db,
|
||||
tenant_id,
|
||||
rid,
|
||||
body.name,
|
||||
body.permissions,
|
||||
body.field_permissions,
|
||||
)
|
||||
if role is None:
|
||||
raise HTTPException(404, detail={"detail": "Role not found", "code": "not_found"})
|
||||
@@ -89,7 +99,9 @@ async def delete_role(
|
||||
try:
|
||||
rid = uuid.UUID(role_id)
|
||||
except ValueError:
|
||||
raise HTTPException(400, detail={"detail": "Invalid role_id", "code": "invalid_id"})
|
||||
raise HTTPException(
|
||||
400, detail={"detail": "Invalid role_id", "code": "invalid_id"}
|
||||
) from None
|
||||
|
||||
success = await role_service.delete_role(db, tenant_id, rid)
|
||||
if not success:
|
||||
|
||||
Reference in New Issue
Block a user