This commit is contained in:
2024-03-03 07:22:42 +03:00
parent 804b658c6e
commit d870f1cffe
27 changed files with 303 additions and 78 deletions

20
main.py
View File

@@ -1,28 +1,14 @@
from typing import Annotated
from fastapi import FastAPI
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
routers.auth_router,
routers.deal_router
]
for router in routers_list:
app.include_router(router)
@app.get("/")
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}")
async def say_hello(name: str):
return {"message": f"Hello {name}"}