Refatoring : Working state
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# Architecture
|
||||
|
||||
> **Refactor DDD légère — lots 1 à 4**
|
||||
> **Architecture cible après cleanup final**
|
||||
>
|
||||
> `Post/`, `Category/`, `User/`, `Media/` et `Auth/` introduisent maintenant une organisation verticale
|
||||
> `Application / Infrastructure / Http / Domain` pour alléger la lecture et préparer
|
||||
> un découpage plus fin par cas d'usage. Les classes historiques à la racine du domaine
|
||||
> sont conservées comme **ponts de compatibilité** afin de préserver les routes, le conteneur
|
||||
> DI et la suite de tests pendant la transition.
|
||||
> `Post/`, `Category/`, `User/`, `Media/` et `Auth/` suivent maintenant une organisation verticale
|
||||
> `Application / Infrastructure / Http / Domain`. Les anciennes classes de transition
|
||||
> ont été retirées : routes, conteneur DI et tests pointent directement vers les
|
||||
> implémentations finales, ce qui réduit la dette de compatibilité tout en conservant
|
||||
> les mêmes fonctionnalités.
|
||||
|
||||
## Domaines PHP
|
||||
|
||||
@@ -27,13 +27,13 @@ contrôleur. Les dépendances inter-domaines sont explicites, minimales et toujo
|
||||
|
||||
Le projet compte deux dépendances explicites entre domaines métier :
|
||||
|
||||
**`Auth/ → User/`** — `AuthService` et `PasswordResetService` consomment `UserRepositoryInterface`
|
||||
**`Auth/ → User/`** — `AuthApplicationService` et `PasswordResetApplicationService` consomment `UserRepositoryInterface`
|
||||
pour lire les comptes lors de l'authentification et de la réinitialisation de mot de passe.
|
||||
Unidirectionnelle : `User/` n'importe rien de `Auth/`.
|
||||
|
||||
**`Post/ → Category/`** — `PostController` injecte `CategoryServiceInterface` pour alimenter
|
||||
la liste des catégories dans le formulaire de création/édition d'article. Dépendance de
|
||||
présentation uniquement : `PostService` et `PostRepository` ne connaissent pas `Category/`.
|
||||
présentation uniquement : `PostApplicationService` et `PdoPostRepository` ne connaissent pas `Category/`.
|
||||
Unidirectionnelle : `Category/` n'importe rien de `Post/`.
|
||||
|
||||
### Structure d'un domaine
|
||||
@@ -89,10 +89,10 @@ final class PostService
|
||||
| `PasswordResetRepositoryInterface` | `PdoPasswordResetRepository` | `Auth/` |
|
||||
| `PasswordResetServiceInterface` | `PasswordResetApplicationService` | `Auth/` |
|
||||
| `AuthServiceInterface` | `AuthApplicationService` | `Auth/` |
|
||||
| `PostRepositoryInterface` | `PostRepository` | `Post/` |
|
||||
| `PostServiceInterface` | `PostService` | `Post/` |
|
||||
| `CategoryRepositoryInterface` | `CategoryRepository` | `Category/`|
|
||||
| `CategoryServiceInterface` | `CategoryService` | `Category/`|
|
||||
| `PostRepositoryInterface` | `PdoPostRepository` | `Post/` |
|
||||
| `PostServiceInterface` | `PostApplicationService` | `Post/` |
|
||||
| `CategoryRepositoryInterface` | `PdoCategoryRepository` | `Category/`|
|
||||
| `CategoryServiceInterface` | `CategoryApplicationService` | `Category/`|
|
||||
| `MediaRepositoryInterface` | `PdoMediaRepository` | `Media/` |
|
||||
| `MediaServiceInterface` | `MediaApplicationService` | `Media/` |
|
||||
| `MediaStorageInterface` | `LocalMediaStorage` | `Media/` |
|
||||
@@ -106,13 +106,13 @@ Les erreurs métier levées intentionnellement utilisent des exceptions dédiée
|
||||
|
||||
| Exception | Namespace | Levée par |
|
||||
|------------------------------|------------------------|--------------------------------------------------------|
|
||||
| `DuplicateUsernameException` | `App\User\Exception` | `UserService::createUser()` |
|
||||
| `DuplicateEmailException` | `App\User\Exception` | `UserService::createUser()` |
|
||||
| `WeakPasswordException` | `App\User\Exception` | `UserService`, `AuthService`, `PasswordResetService` |
|
||||
| `NotFoundException` | `App\Shared\Exception` | `PostService`, `AuthService` |
|
||||
| `FileTooLargeException` | `App\Media\Exception` | `MediaService::store()` |
|
||||
| `InvalidMimeTypeException` | `App\Media\Exception` | `MediaService::store()` |
|
||||
| `StorageException` | `App\Media\Exception` | `MediaService::store()` |
|
||||
| `DuplicateUsernameException` | `App\User\Exception` | `UserApplicationService::createUser()` |
|
||||
| `DuplicateEmailException` | `App\User\Exception` | `UserApplicationService::createUser()` |
|
||||
| `WeakPasswordException` | `App\User\Exception` | `UserApplicationService`, `AuthApplicationService`, `PasswordResetApplicationService` |
|
||||
| `NotFoundException` | `App\Shared\Exception` | `PostApplicationService`, `AuthApplicationService` |
|
||||
| `FileTooLargeException` | `App\Media\Exception` | `MediaApplicationService::store()` |
|
||||
| `InvalidMimeTypeException` | `App\Media\Exception` | `MediaApplicationService::store()` |
|
||||
| `StorageException` | `App\Media\Exception` | `MediaApplicationService::store()` |
|
||||
|
||||
## Base de données
|
||||
|
||||
|
||||
Reference in New Issue
Block a user