forked from mtusi2026/mtusi2026lab4
Carry over the lab 3 solution
Bring the application, own tests, Dockerfile, toolchain, compose stack, HAProxy and k6 configuration, migrations, hooks, evidence and level 4 scripts and the CI job from the lab 3 solution commit 61c0c28, merge the lab 3 Makefile targets into the lab 4 skeleton Makefile without touching its targets, and append the lab 3 solution variables to the skeleton .env.example. The package and the application follow the contract version 1.4.0, and the image and the throwaway test containers are tagged lab4 so they do not collide with a lab 3 stand on the same host. This is the starting point of the lab 4 cycle: lint, own tests and the offline skeleton check pass before any lab 4 change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b0f463ac5c
commit
bf8e4e3cd1
@@ -0,0 +1,48 @@
|
||||
from datetime import datetime
|
||||
from typing import Protocol, runtime_checkable
|
||||
from uuid import UUID
|
||||
|
||||
from messenger.identity.domain.models import Session, User
|
||||
from messenger.shared.application.ports import UnitOfWork
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class UserRepository(Protocol):
|
||||
async def add(self, user: User) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class SessionRepository(Protocol):
|
||||
async def add(self, session: Session) -> None: ...
|
||||
|
||||
async def remove(self, token_hash: bytes) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class IdentityUnitOfWork(UnitOfWork, Protocol):
|
||||
@property
|
||||
def users(self) -> UserRepository: ...
|
||||
|
||||
@property
|
||||
def sessions(self) -> SessionRepository: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class UserDirectory(Protocol):
|
||||
async def find(self, user_id: UUID) -> User | None: ...
|
||||
|
||||
async def find_by_username(self, username: str) -> User | None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class SessionDirectory(Protocol):
|
||||
async def find(self, token_hash: bytes, now: datetime) -> Session | None: ...
|
||||
|
||||
async def invalidate(self, session: Session) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class PasswordHasher(Protocol):
|
||||
async def hash(self, password: str) -> str: ...
|
||||
|
||||
async def verify(self, password_hash: str | None, password: str) -> bool: ...
|
||||
Reference in New Issue
Block a user