feat: add OpenAPI tags

This commit is contained in:
2025-03-21 15:06:44 +01:00
parent d9ad903798
commit ab3ed9b497
3 changed files with 11 additions and 8 deletions

View File

@@ -22,7 +22,9 @@ C = Chemistry
R = MVPRanking
P = Player
app = FastAPI(title="cutt")
app = FastAPI(
title="cutt", swagger_ui_parameters={"syntaxHighlight": {"theme": "monokai"}}
)
api_router = APIRouter(prefix="/api")
origins = [
"https://cutt.0124816.xyz",
@@ -53,6 +55,7 @@ def list_teams():
team_router = APIRouter(
prefix="/team",
dependencies=[Security(get_current_active_user, scopes=["admin"])],
tags=["team"],
)
team_router.add_api_route("/list", endpoint=list_teams, methods=["GET"])
team_router.add_api_route("/add", endpoint=add_team, methods=["POST"])
@@ -67,7 +70,7 @@ somethings_fishy = HTTPException(
)
@api_router.put("/mvps")
@api_router.put("/mvps", tags=["analysis"])
def submit_mvps(
mvps: MVPRanking,
user: Annotated[Player, Depends(get_current_active_user)],
@@ -87,7 +90,7 @@ def submit_mvps(
raise wrong_user_id_exception
@api_router.get("/mvps")
@api_router.get("/mvps", tags=["analysis"])
def get_mvps(
user: Annotated[Player, Depends(get_current_active_user)],
):
@@ -111,7 +114,7 @@ def get_mvps(
)
@api_router.put("/chemistry")
@api_router.put("/chemistry", tags=["analysis"])
def submit_chemistry(
chemistry: Chemistry, user: Annotated[Player, Depends(get_current_active_user)]
):
@@ -132,7 +135,7 @@ def submit_chemistry(
raise wrong_user_id_exception
@api_router.get("/chemistry")
@api_router.get("/chemistry", tags=["analysis"])
def get_chemistry(user: Annotated[Player, Depends(get_current_active_user)]):
with Session(engine) as session:
subquery = (