This commit is contained in:
Waylon Walker 2023-06-06 09:57:21 -05:00
parent 6b1c60a550
commit 839cbd0dc0
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
17 changed files with 213 additions and 35 deletions

View file

@ -11,8 +11,8 @@ hero_router = APIRouter()
@hero_router.on_event("startup")
def on_startup(config: Config = Depends(get_config)) -> None:
SQLModel.metadata.create_all(config.database.engine)
def on_startup() -> None:
SQLModel.metadata.create_all(get_config().database.engine)
@hero_router.get("/items/")
@ -26,6 +26,12 @@ def get_hero(id: int, config: Config = Depends(get_config)) -> Hero:
return Hero().get(id=id, config=config)
@hero_router.get("/h/{id}")
def get_h(id: int, config: Config = Depends(get_config)) -> Hero:
"get one hero"
return Hero().get(id=id, config=config)
@hero_router.post("/hero/")
def post_hero(hero: Hero, config: Config = Depends(get_config)) -> Hero:
"read all the heros"