- shared-moduuli: DomainError, EmailAddress, UnitOfWork, tapahtumat, TimestampedModel, daisyUI-lomakerenderöinti ja yhteiset pohjat - users-moduuli Clean Architecture -kerroksin: oma käyttäjämalli (AUTH_USER_MODEL), roolit ja oikeudet, harjoittelija-, vastuuhenkilö- ja viimeisen pääkäyttäjän säännöt - kirjautuminen sähköpostilla, yritysten rajoitus, "muista minut", istunnon katkaisu kun tunnus poistetaan käytöstä tai harjoittelu päättyy - kertakäyttöiset salasanalinkit (72 h / 60 min, uusi mitätöi vanhan), salasanasääntö ja create_admin-komento - käyttäjähallinta: lista (HTMX-haku), lomakkeet ja kopioitava linkki - Tailwind 4 + daisyUI 5 + HTMX + Alpine npm-buildilla, suomennokset - testit: domain, application (fakeilla), integraatio ja selaintestit (axe, vaalea/tumma, 1920/320 px); ruff, mypy ja import-linter - dokumentit päivitetty toteutuksen mukaisiksi Co-Authored-By: Claude Opus 5.5 <[email protected]>
35 lines
853 B
Python
35 lines
853 B
Python
"""Ports that application layers of all modules depend on."""
|
|
|
|
from collections.abc import Callable
|
|
from contextlib import AbstractContextManager
|
|
from datetime import date
|
|
from types import TracebackType
|
|
from typing import Protocol
|
|
|
|
|
|
class UnitOfWork(Protocol):
|
|
"""Transaction boundary of a use case: ``with uow: ...``."""
|
|
|
|
def __enter__(self) -> object: ...
|
|
|
|
def __exit__(
|
|
self,
|
|
exc_type: type[BaseException] | None,
|
|
exc: BaseException | None,
|
|
tb: TracebackType | None,
|
|
) -> bool | None: ...
|
|
|
|
|
|
class EventPublisher(Protocol):
|
|
def publish(self, event: object) -> None: ...
|
|
|
|
|
|
class Clock(Protocol):
|
|
def today(self) -> date:
|
|
"""Current date in the business time zone."""
|
|
...
|
|
|
|
|
|
EventHandler = Callable[[object], None]
|
|
TransactionFactory = Callable[[], AbstractContextManager[object]]
|