minor: ruff formatter
All changes are either: - Correcting tabs - Adding/removing line breaks - Adding trailing commas
This commit is contained in:
parent
b2e5dd2ebb
commit
c689ac1e10
91 changed files with 1710 additions and 689 deletions
|
|
@ -7,11 +7,16 @@ Endpoints:
|
|||
- [GET](/user/): [super admin]: Returns user(id) details.
|
||||
- [DELETE](/user/): [super admin]: Removes a User(id) from the hub database.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
from starlette import status
|
||||
|
||||
from src.user.schemas import UserResponse, OIDCClaims, UserDeleteUserRequest
|
||||
from src.user.dependencies import user_model_claims_dependency, user_model_query_dependency, user_model_body_dependency
|
||||
from src.user.dependencies import (
|
||||
user_model_claims_dependency,
|
||||
user_model_query_dependency,
|
||||
user_model_body_dependency,
|
||||
)
|
||||
|
||||
from src.auth.dependencies import super_admin_dependency
|
||||
from src.auth.service import claims_dependency
|
||||
|
|
@ -23,13 +28,15 @@ router = APIRouter(
|
|||
)
|
||||
|
||||
|
||||
@router.get("/self/claims",
|
||||
summary="Get current user OIDC claims.",
|
||||
response_model=OIDCClaims,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
})
|
||||
@router.get(
|
||||
"/self/claims",
|
||||
summary="Get current user OIDC claims.",
|
||||
response_model=OIDCClaims,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
},
|
||||
)
|
||||
async def current_user_claims(user: claims_dependency):
|
||||
"""
|
||||
Returns the full OIDC claims associated with the currently logged-in user.
|
||||
|
|
@ -38,14 +45,16 @@ async def current_user_claims(user: claims_dependency):
|
|||
return user
|
||||
|
||||
|
||||
@router.get("/self/db",
|
||||
summary="Get current user hub details.",
|
||||
response_model=UserResponse,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
})
|
||||
@router.get(
|
||||
"/self/db",
|
||||
summary="Get current user hub details.",
|
||||
response_model=UserResponse,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
},
|
||||
)
|
||||
async def current_user(user_model: user_model_claims_dependency):
|
||||
"""
|
||||
Returns the database details associated with the currently logged-in user.
|
||||
|
|
@ -53,30 +62,40 @@ async def current_user(user_model: user_model_claims_dependency):
|
|||
return user_model
|
||||
|
||||
|
||||
@router.get("/",
|
||||
summary="Get user hub details by ID.",
|
||||
response_model=UserResponse,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
})
|
||||
async def get_user_by_id(user_model: user_model_query_dependency, su: super_admin_dependency):
|
||||
@router.get(
|
||||
"/",
|
||||
summary="Get user hub details by ID.",
|
||||
response_model=UserResponse,
|
||||
status_code=status.HTTP_200_OK,
|
||||
responses={
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||
},
|
||||
)
|
||||
async def get_user_by_id(
|
||||
user_model: user_model_query_dependency, su: super_admin_dependency
|
||||
):
|
||||
"""
|
||||
Returns the database details associated with the provided user ID.
|
||||
"""
|
||||
return user_model
|
||||
|
||||
|
||||
@router.delete("/",
|
||||
summary="Delete user from hub by ID.",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
responses={
|
||||
status.HTTP_204_NO_CONTENT: {"description": "User deleted"},
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
})
|
||||
async def delete_user_by_id(db: db_dependency, user_model: user_model_body_dependency, su: super_admin_dependency,
|
||||
request_model: UserDeleteUserRequest):
|
||||
@router.delete(
|
||||
"/",
|
||||
summary="Delete user from hub by ID.",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
responses={
|
||||
status.HTTP_204_NO_CONTENT: {"description": "User deleted"},
|
||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||
},
|
||||
)
|
||||
async def delete_user_by_id(
|
||||
db: db_dependency,
|
||||
user_model: user_model_body_dependency,
|
||||
su: super_admin_dependency,
|
||||
request_model: UserDeleteUserRequest,
|
||||
):
|
||||
"""
|
||||
Deletes the user with the provided ID from the database. This will not remove them from OIDC, and they will be automatically readded on next login.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue