mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
branch out "sandbox" stuff
This commit is contained in:
parent
23820bc9dc
commit
d26a75ebcc
2 changed files with 1 additions and 59 deletions
|
@ -1,10 +1,9 @@
|
|||
from fastapi import APIRouter
|
||||
|
||||
from . import abspacken, days, general, user
|
||||
from . import days, general, user
|
||||
|
||||
router = APIRouter(prefix="/api")
|
||||
|
||||
router.include_router(abspacken.router)
|
||||
router.include_router(days.router)
|
||||
router.include_router(general.router)
|
||||
router.include_router(user.router)
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
import asyncio
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from .user import require_admin
|
||||
|
||||
router = APIRouter(prefix="/abspacken", tags=["abspacken"])
|
||||
|
||||
|
||||
async def get_kurix(kgs: float) -> float:
|
||||
# die berechnung ist sehr aufwändig, braucht lange!
|
||||
await asyncio.sleep(2)
|
||||
|
||||
return kgs / 1.13
|
||||
|
||||
|
||||
@router.post("/uwe")
|
||||
async def uwe(
|
||||
kgs: float = 10,
|
||||
firma: str = "Vodafone",
|
||||
_: None = Depends(require_admin),
|
||||
) -> 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 f"Der Alphakevin Torsten hat ein langes {ding}."
|
||||
|
||||
|
||||
@router.get(
|
||||
"/kys",
|
||||
responses={
|
||||
status.HTTP_200_OK: {
|
||||
"description": "Einfach NEIN",
|
||||
"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.
|
||||
|
||||
Also: <br />
|
||||
Sinnlose Todesdrohungen und Synapsenfasching.
|
||||
"""
|
||||
|
||||
raise HTTPException(status.HTTP_418_IM_A_TEAPOT, "Go kill yourself")
|
Loading…
Reference in a new issue