26 lines
585 B
Python
26 lines
585 B
Python
from typing import TYPE_CHECKING, Any, Protocol
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
if TYPE_CHECKING:
|
|
from src.repository.auth import AuthRepo
|
|
from src.repository.tasks import TasksRepo
|
|
from src.repository.users import UsersRepo
|
|
|
|
|
|
class HasId(Protocol):
|
|
id: Any
|
|
|
|
|
|
class IUOWDB(Protocol):
|
|
session: AsyncSession
|
|
user: "UsersRepo"
|
|
task: "TasksRepo"
|
|
auth: "AuthRepo"
|
|
|
|
async def __aenter__(self) -> "IUOWDB": ...
|
|
|
|
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
|
|
|
|
async def commit(self) -> None: ...
|