New structure

This commit is contained in:
2025-04-21 13:50:51 +02:00
parent 1eba79cc5a
commit abe0cbb173
45 changed files with 10 additions and 50 deletions

View File

@@ -0,0 +1,18 @@
import abc
from contextlib import asynccontextmanager
from core.mongo import mongo_manager
class BaseRepository(abc.ABC):
COLLECTION_NAME: str
@classmethod
@asynccontextmanager
async def connect(cls):
async with mongo_manager.connect() as client:
db = client.get_default_database()
collection = db[cls.COLLECTION_NAME]
yield collection