refactor(auth): factory-style use cases + controllers + real Payload impls

- Use cases (sign-in, sign-up, sign-out) → factory functions with I*UseCase aliases
- Controllers → factory functions with I*Controller aliases
- DI symbols + module updated with .toDynamicValue() bindings for factories
- New: real UsersRepository (Payload-backed, SanitizedConfig, contract-tested)
- New: real AuthenticationService (node:crypto hashing/UUIDs; createSession/
  validateSession/invalidateSession deferred — see refactor log §7)
- bindProductionAuth swaps both mocks for real impls (was a no-op before)
- Tests refactored to construct mocks and inject directly (no container rebinding)
- Feature test constructs full chain via direct factory injection

Refactor log: §2, §4.1, §4.2, §5.1, §5.2, §6.1, §7
Spec: §6.1, §7

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 00:01:11 +02:00
parent aa325f91cc
commit 780d5cb83b
24 changed files with 694 additions and 349 deletions

View File

@@ -1,4 +1,12 @@
export const AUTH_SYMBOLS = {
IUsersRepository: Symbol.for("auth:IUsersRepository"),
IAuthenticationService: Symbol.for("auth:IAuthenticationService"),
// Use cases
ISignInUseCase: Symbol.for("auth:ISignInUseCase"),
ISignUpUseCase: Symbol.for("auth:ISignUpUseCase"),
ISignOutUseCase: Symbol.for("auth:ISignOutUseCase"),
// Controllers
ISignInController: Symbol.for("auth:ISignInController"),
ISignUpController: Symbol.for("auth:ISignUpController"),
ISignOutController: Symbol.for("auth:ISignOutController"),
} as const;