18 lines
513 B
Python
18 lines
513 B
Python
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from .user import UserRepository
|
|
from .product import ProductRepository
|
|
from ..domain import User, Product
|
|
|
|
|
|
class Repository:
|
|
def __init__(self, session: AsyncSession):
|
|
self.session = session
|
|
self.user = UserRepository(User, session)
|
|
self.product = ProductRepository(Product, session)
|
|
|
|
async def commit(self) -> None:
|
|
await self.session.commit()
|
|
|
|
async def rollback(self) -> None:
|
|
await self.session.rollback()
|