From 85a6c0d795417b7539068cb3e0640b41689f947b Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 7 Apr 2026 11:37:09 +0200 Subject: [PATCH] refactor : reorganize codebase to DDD architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend: - src/Api/Auth/State/ — MeProvider, UserPasswordHasherProcessor - src/Api/Shared/Resource/ — AppVersion - src/Api/Shared/State/ — AppVersionProvider - src/Domain/, src/Application/, src/Infrastructure/ — skeleton ready - User entity stays in src/Entity/ (framework, outside DDD) Frontend: - frontend/domains/ — skeleton ready for bounded contexts Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/domains/.gitkeep | 0 src/{ => Api/Auth}/State/MeProvider.php | 2 +- src/{ => Api/Auth}/State/UserPasswordHasherProcessor.php | 2 +- src/{ApiResource => Api/Shared/Resource}/AppVersion.php | 4 ++-- src/{ => Api/Shared}/State/AppVersionProvider.php | 5 +++-- src/Application/.gitkeep | 0 src/Domain/.gitkeep | 0 src/Entity/User.php | 4 ++-- src/Infrastructure/Shared/.gitkeep | 0 9 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 frontend/domains/.gitkeep rename src/{ => Api/Auth}/State/MeProvider.php (94%) rename src/{ => Api/Auth}/State/UserPasswordHasherProcessor.php (97%) rename src/{ApiResource => Api/Shared/Resource}/AppVersion.php (81%) rename src/{ => Api/Shared}/State/AppVersionProvider.php (81%) create mode 100644 src/Application/.gitkeep create mode 100644 src/Domain/.gitkeep create mode 100644 src/Infrastructure/Shared/.gitkeep diff --git a/frontend/domains/.gitkeep b/frontend/domains/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/State/MeProvider.php b/src/Api/Auth/State/MeProvider.php similarity index 94% rename from src/State/MeProvider.php rename to src/Api/Auth/State/MeProvider.php index 972d33a..a3b3c45 100644 --- a/src/State/MeProvider.php +++ b/src/Api/Auth/State/MeProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\State; +namespace App\Api\Auth\State; use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProviderInterface; diff --git a/src/State/UserPasswordHasherProcessor.php b/src/Api/Auth/State/UserPasswordHasherProcessor.php similarity index 97% rename from src/State/UserPasswordHasherProcessor.php rename to src/Api/Auth/State/UserPasswordHasherProcessor.php index d73294c..439c8ea 100644 --- a/src/State/UserPasswordHasherProcessor.php +++ b/src/Api/Auth/State/UserPasswordHasherProcessor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\State; +namespace App\Api\Auth\State; use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProcessorInterface; diff --git a/src/ApiResource/AppVersion.php b/src/Api/Shared/Resource/AppVersion.php similarity index 81% rename from src/ApiResource/AppVersion.php rename to src/Api/Shared/Resource/AppVersion.php index 367d816..723eeb3 100644 --- a/src/ApiResource/AppVersion.php +++ b/src/Api/Shared/Resource/AppVersion.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\ApiResource; +namespace App\Api\Shared\Resource; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; -use App\State\AppVersionProvider; +use App\Api\Shared\State\AppVersionProvider; #[ApiResource( operations: [ diff --git a/src/State/AppVersionProvider.php b/src/Api/Shared/State/AppVersionProvider.php similarity index 81% rename from src/State/AppVersionProvider.php rename to src/Api/Shared/State/AppVersionProvider.php index 1d573db..34e2ad2 100644 --- a/src/State/AppVersionProvider.php +++ b/src/Api/Shared/State/AppVersionProvider.php @@ -2,10 +2,11 @@ declare(strict_types=1); -namespace App\State; +namespace App\Api\Shared\State; use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProviderInterface; +use App\Api\Shared\Resource\AppVersion; use Symfony\Component\DependencyInjection\Attribute\Autowire; /** @@ -20,6 +21,6 @@ class AppVersionProvider implements ProviderInterface public function provide(Operation $operation, array $uriVariables = [], array $context = []): object { - return new \App\ApiResource\AppVersion($this->appVersion); + return new AppVersion($this->appVersion); } } diff --git a/src/Application/.gitkeep b/src/Application/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Domain/.gitkeep b/src/Domain/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Entity/User.php b/src/Entity/User.php index 85054d0..ee56318 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -10,9 +10,9 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Post; +use App\Api\Auth\State\MeProvider; +use App\Api\Auth\State\UserPasswordHasherProcessor; use App\Repository\UserRepository; -use App\State\MeProvider; -use App\State\UserPasswordHasherProcessor; use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; diff --git a/src/Infrastructure/Shared/.gitkeep b/src/Infrastructure/Shared/.gitkeep new file mode 100644 index 0000000..e69de29