This commit is contained in:
2024-03-01 00:07:25 +03:00
parent 02c6956763
commit 80e817d70a
17 changed files with 104 additions and 6 deletions

21
main.py
View File

@@ -1,11 +1,26 @@
from fastapi import FastAPI
from typing import Annotated
from fastapi import FastAPI, Depends
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from database.base import get_session
from database.models import User
import routers
app = FastAPI()
routers_list = [
routers.auth_router
]
for router in routers_list:
app.include_router(router)
@app.get("/")
async def root():
return {"message": "Hello World"}
async def root(db_session: Annotated[AsyncSession, Depends(get_session)]):
user: User = await db_session.scalar(select(User).where(User.id == 1))
return {"message": user.login}
@app.get("/hello/{name}")