mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-09-10 17:20:41 +03:00
* remove fastapi users dependency * add user service to chatbot service * add user save on bot info command * add user model to admin * fix tests
19 lines
518 B
Python
19 lines
518 B
Python
from fastapi import Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from starlette.requests import Request
|
|
|
|
from infra.database.db_adapter import Database
|
|
from settings.config import AppSettings
|
|
|
|
|
|
def get_settings(request: Request) -> AppSettings:
|
|
return request.app.state.settings
|
|
|
|
|
|
def get_db_session(request: Request) -> AsyncSession:
|
|
return request.app.state.db_session_factory()
|
|
|
|
|
|
def get_database(settings: AppSettings = Depends(get_settings)) -> Database:
|
|
return Database(settings=settings)
|