init
This commit is contained in:
15
app/application/users/ports/unit_of_work.py
Normal file
15
app/application/users/ports/unit_of_work.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Protocol, runtime_checkable
|
||||
|
||||
from app.application.users.ports.user_repository import UserRepository
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class UnitOfWork(Protocol):
|
||||
users: UserRepository
|
||||
|
||||
async def __aenter__(self) -> "UnitOfWork": ...
|
||||
async def __aexit__(self, exc_type, exc, tb) -> None: ...
|
||||
async def commit(self) -> None: ...
|
||||
async def rollback(self) -> None: ...
|
||||
12
app/application/users/ports/user_repository.py
Normal file
12
app/application/users/ports/user_repository.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Protocol
|
||||
from uuid import UUID
|
||||
|
||||
from app.domain.users.entities import User
|
||||
|
||||
|
||||
class UserRepository(Protocol):
|
||||
async def add(self, user: User) -> None: ...
|
||||
async def get_by_id(self, user_id: UUID) -> User | None: ...
|
||||
async def get_by_email(self, email: str) -> User | None: ...
|
||||
Reference in New Issue
Block a user