feat: troppa roba davvero
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
from core.config import settings
|
||||
from typing import Any
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
|
||||
|
||||
from app.core.config import settings
|
||||
|
||||
|
||||
class _MongoDB:
|
||||
client: AsyncIOMotorClient | None = None
|
||||
client: AsyncIOMotorClient[dict[str, Any]] | None = None
|
||||
|
||||
def get_database(self) -> AsyncIOMotorDatabase:
|
||||
def get_database(self) -> AsyncIOMotorDatabase[dict[str, Any]]:
|
||||
if self.client is None:
|
||||
raise RuntimeError("MongoDB client has not been initialized")
|
||||
return self.client[settings.MONGODB_DB_NAME]
|
||||
@@ -26,7 +29,7 @@ async def close_mongodb() -> None:
|
||||
client.close()
|
||||
|
||||
|
||||
async def get_database() -> AsyncIOMotorDatabase:
|
||||
async def get_database() -> AsyncIOMotorDatabase[dict[str, Any]]:
|
||||
return mongodb.get_database()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user