2022-10-09 00:18:15 +00:00
|
|
|
import asyncio
|
|
|
|
|
2022-11-15 22:17:32 +00:00
|
|
|
from fastapi import APIRouter, Depends, HTTPException, status
|
|
|
|
|
|
|
|
from .user import require_admin
|
2022-10-09 00:18:15 +00:00
|
|
|
|
|
|
|
router = APIRouter(prefix="/abspacken", tags=["abspacken"])
|
|
|
|
|
|
|
|
|
|
|
|
async def get_kurix(kgs: float) -> float:
|
2022-10-09 00:40:20 +00:00
|
|
|
# die berechnung ist sehr aufwändig, braucht lange!
|
2022-10-09 00:18:15 +00:00
|
|
|
await asyncio.sleep(2)
|
|
|
|
|
|
|
|
return kgs / 1.13
|
|
|
|
|
|
|
|
|
|
|
|
@router.post("/uwe")
|
|
|
|
async def uwe(
|
|
|
|
kgs: float = 10,
|
2022-11-15 22:17:32 +00:00
|
|
|
firma: str = "Vodafone",
|
|
|
|
_: None = Depends(require_admin),
|
2022-10-09 00:18:15 +00:00
|
|
|
) -> str:
|
|
|
|
kurix = await get_kurix(kgs)
|
|
|
|
|
|
|
|
return f"UWE hat bei {firma} einen beachtlichen Haufen von " \
|
|
|
|
f"{kgs} Kg ({kurix:.3f} Kurix) auf den Läufer geschissen."
|
|
|
|
|
|
|
|
|
|
|
|
@router.get("/torsten/{ding}")
|
|
|
|
async def torsten(ding: str) -> str:
|
|
|
|
return "Der Alphakevin Torsten hat ein " f"langes {ding}."
|
2022-10-09 00:40:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
@router.get(
|
|
|
|
"/kys",
|
|
|
|
responses={
|
|
|
|
status.HTTP_200_OK: {
|
|
|
|
"description": "Success",
|
|
|
|
"content": None,
|
|
|
|
},
|
|
|
|
status.HTTP_418_IM_A_TEAPOT: {
|
|
|
|
"description": "Commit Sudoku",
|
|
|
|
"content": None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
async def kys() -> None:
|
|
|
|
"""
|
|
|
|
Heiße Botschaften aus der Nachbarschaft warten auf Sie.
|
2022-10-09 00:47:30 +00:00
|
|
|
|
|
|
|
Also: <br />
|
|
|
|
Sinnlose Todesdrohungen und Synapsenfasching.
|
2022-10-09 00:40:20 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
raise HTTPException(status.HTTP_418_IM_A_TEAPOT, "Go kill yourself")
|