From 8d896bcd12cd63fb6bb13c0563216650be064b05 Mon Sep 17 00:00:00 2001 From: Flo Date: Wed, 14 Feb 2024 20:38:28 +0100 Subject: [PATCH] first commit --- .env.example | 15 +- bin/console.php | 2 +- bin/createApi.php | 155 ++++++++++++++++++ bin/createPipeline.php | 149 +++++++++++++++++ bin/doctrine-migrations-log.php | 4 +- bin/doctrine-migrations.php | 10 +- bin/script/init | 10 +- composer.development.json | 103 ++++++------ composer.json | 21 +-- config/autoload/api.global.php | 6 +- config/autoload/authorization.global.php | 2 +- config/autoload/logger.global.php | 4 +- config/autoload/mezzio.global.php | 8 +- config/config.php | 36 ++-- config/pipeline.php | 12 +- config/routes.php | 2 +- .../homepage/Version20230922101352.php | 38 ----- .../homepage/Version20231021103120.php | 33 ---- .../homepage/Version20231021112654.php | 33 ---- data/migrations/log/Version20230922150649.php | 2 +- .../Version20230922085011.php | 2 +- .../Version20230922092351.php | 2 +- .../Version20230922092754.php | 2 +- .../Version20230922101354.php | 2 +- .../Version20230922101355.php | 2 +- .../Version20230924113403.php | 3 +- docker/docker-compose-mac.yml | 28 ++-- docker/docker-compose.yml | 24 +-- docker/mysql/scripts/initdb.sql | 4 +- docker/nginx/config/nginx.conf | 2 +- src/ApiDomain/Console/config/console.php | 4 +- .../Console/config/service_manager.php | 4 +- .../src/Command/InitializeDataCommand.php | 18 +- .../Console/src/Command/RbacUpdateCommand.php | 18 +- src/ApiDomain/Console/src/ConfigProvider.php | 2 +- .../External/Authentication/config/routes.php | 10 +- .../Authentication/config/service_manager.php | 8 +- .../Authentication/src/ConfigProvider.php | 2 +- .../Handler/ConfirmRegistrationHandler.php | 10 +- .../src/Handler/LoginUserHandler.php | 8 +- .../src/Handler/LogoutUserHandler.php | 10 +- .../src/Handler/RegisterUserHandler.php | 16 +- .../External/Health/config/routes.php | 2 +- .../Health/config/service_manager.php | 2 +- .../External/Health/src/ConfigProvider.php | 2 +- .../Health/src/Handler/HealthHandler.php | 2 +- src/ApiDomain/External/User/config/routes.php | 12 +- .../External/User/config/service_manager.php | 10 +- .../External/User/src/ConfigProvider.php | 2 +- .../User/src/Formatter/UserFormatter.php | 4 +- .../src/Handler/ChangePasswordHandler.php | 12 +- .../src/Handler/ChangeUsernameHandler.php | 12 +- .../User/src/Handler/CreateUserHandler.php | 8 +- .../User/src/Handler/UserStateHandler.php | 12 +- src/DataDomain/Business/config/doctrine.php | 18 +- .../Business/config/service_manager.php | 20 +-- .../Business/src/ConfigProvider.php | 2 +- .../Business/src/Entity/Permission.php | 10 +- .../Business/src/Entity/Registration.php | 6 +- src/DataDomain/Business/src/Entity/Role.php | 10 +- src/DataDomain/Business/src/Entity/User.php | 10 +- .../Business/src/Entity/UserSession.php | 8 +- .../Factory/MyTubeEntityManagerFactory.php | 19 +++ .../Factory/TemplateEntityManagerFactory.php | 19 --- .../src/Manager/MyTubeEntityManager.php | 11 ++ .../src/Manager/TemplateEntityManager.php | 11 -- .../src/Repository/PermissionRepository.php | 2 +- .../src/Repository/ProductRepository.php | 2 +- .../src/Repository/RegistrationRepository.php | 4 +- .../src/Repository/RoleRepository.php | 2 +- .../src/Repository/UserRepository.php | 4 +- .../src/Repository/UserSessionRepository.php | 6 +- src/DataDomain/Log/config/doctrine.php | 4 +- src/DataDomain/Log/config/service_manager.php | 4 +- src/DataDomain/Log/src/ConfigProvider.php | 2 +- src/DataDomain/Log/src/Entity/Log.php | 6 +- .../src/Factory/LogEntityManagerFactory.php | 4 +- .../Log/src/Manager/LogEntityManager.php | 2 +- .../Log/src/Repository/LogRepository.php | 2 +- .../Product/config/service_manager.php | 43 ----- .../Product/src/Builder/ProductBuilder.php | 23 --- .../Product/src/ConfigProvider.php | 15 -- .../ProductNotFoundByIdException.php | 27 --- .../ProductWithIdentifierAlreadyExists.php | 24 --- .../CreateProduct/CreateProductCommand.php | 22 --- .../CreateProductCommandBuilder.php | 17 -- .../CreateProductCommandHandler.php | 34 ---- .../DeleteProduct/DeleteProductCommand.php | 19 --- .../DeleteProductCommandBuilder.php | 19 --- .../DeleteProductCommandHandler.php | 39 ----- .../UpdateProduct/UpdateProductCommand.php | 32 ---- .../UpdateProductCommandBuilder.php | 23 --- .../UpdateProductCommandHandler.php | 55 ------- .../Query/ProductList/ProductListQuery.php | 17 -- .../ProductList/ProductListQueryBuilder.php | 21 --- .../ProductList/ProductListQueryHandler.php | 29 ---- .../ProductIdentifierAlreadyExistsRule.php | 33 ---- .../Registration/config/service_manager.php | 30 ++-- .../src/Builder/RegistrationBuilder.php | 4 +- .../Registration/src/ConfigProvider.php | 2 +- .../RegistrationNotFoundByIdException.php | 10 +- ...onWithIdentifierAlreadyExistsException.php | 10 +- .../ConfirmRegistrationCommand.php | 2 +- .../ConfirmRegistrationCommandBuilder.php | 2 +- .../ConfirmRegistrationCommandHandler.php | 8 +- .../RegisterUser/RegisterUserCommand.php | 2 +- .../RegisterUserCommandBuilder.php | 2 +- .../RegisterUserCommandHandler.php | 8 +- .../ConfirmRegistrationPayload.php | 10 +- .../ConfirmRegistrationPipeline.php | 8 +- .../Step/CreateUserStep.php | 20 +-- .../Step/LoadRegistrationStep.php | 12 +- .../Step/SaveRegistrationAndUserStep.php | 6 +- .../RegisterUser/RegisterUserPayload.php | 6 +- .../RegisterUser/RegisterUserPipeline.php | 10 +- .../Step/BuildRegistrationStep.php | 4 +- .../RegisterUser/Step/CheckIdentifierStep.php | 10 +- .../Step/SaveRegistrationStep.php | 6 +- .../RegisterUser/Step/SendMailStep.php | 6 +- ...trationWithIdentifierAlreadyExistsRule.php | 10 +- .../RoleNotFoundByIdentifierException.php | 10 +- .../User/config/service_manager.php | 18 +- .../User/src/Builder/UserBuilder.php | 18 +- .../User/src/ConfigProvider.php | 2 +- .../UserNotFoundByIdentifierException.php | 10 +- .../UserPasswordMismatchException.php | 10 +- .../UserWithIdentifierAlreadyExists.php | 10 +- .../Exception/UserWrongPasswordException.php | 10 +- .../ChangePassword/ChangePasswordCommand.php | 4 +- .../ChangePasswordCommandBuilder.php | 4 +- .../ChangePasswordCommandHandler.php | 18 +- .../ChangeUsername/ChangeUsernameCommand.php | 4 +- .../ChangeUsernameCommandBuilder.php | 4 +- .../ChangeUsernameCommandHandler.php | 10 +- .../Command/CreateUser/CreateUserCommand.php | 2 +- .../CreateUser/CreateUserCommandBuilder.php | 2 +- .../CreateUser/CreateUserCommandHandler.php | 12 +- .../User/src/Rule/UserPasswordMatchRule.php | 8 +- .../UserWithIdentifierAlreadyExistsRule.php | 10 +- .../UserSession/config/service_manager.php | 12 +- .../src/Builder/UserSessionBuilder.php | 4 +- .../UserSession/src/ConfigProvider.php | 2 +- .../Command/LoginUser/LoginUserCommand.php | 4 +- .../LoginUser/LoginUserCommandBuilder.php | 4 +- .../LoginUser/LoginUserCommandHandler.php | 30 ++-- .../Command/LogoutUser/LogoutUserCommand.php | 4 +- .../LogoutUser/LogoutUserCommandBuilder.php | 4 +- .../LogoutUser/LogoutUserCommandHandler.php | 16 +- .../src/Rule/UserPasswordMatchesRule.php | 6 +- .../Database/config/service_manager.php | 2 +- .../Database/src/ConfigProvider.php | 2 +- .../Database/src/ConfigServiceFactory.php | 2 +- .../config/service_manager.php | 2 +- .../src/ConfigProvider.php | 2 +- .../src/ConfigServiceFactory.php | 2 +- .../Encryption/config/service_manager.php | 2 +- .../src/Client/EncryptionClient.php | 2 +- .../Encryption/src/ConfigProvider.php | 2 +- .../Exception/config/service_manager.php | 4 +- .../Exception/src/ConfigProvider.php | 2 +- .../Exception/src/ErrorCode.php | 2 +- .../Exception/src/ErrorDomain.php | 2 +- ...plateException.php => MyTubeException.php} | 8 +- ...p => MyTubeExceptionHandlerMiddleware.php} | 12 +- .../Logging/config/service_manager.php | 14 +- .../Logging/src/ConfigProvider.php | 2 +- .../src/Factory/FileStreamHandlerFactory.php | 4 +- .../Logging/src/Factory/LoggerFactory.php | 6 +- .../src/Factory/MonologLoggerFactory.php | 6 +- .../src/Formatter/PrettyFileLogLines.php | 2 +- .../src/Handler/DoctrineLogHandler.php | 6 +- .../Logging/src/Handler/FileStreamHandler.php | 4 +- .../Logging/src/Logger/Logger.php | 8 +- .../Rbac/config/service_manager.php | 2 +- .../Rbac/src/ConfigProvider.php | 2 +- .../EnsureAuthorizationMiddleware.php | 10 +- .../Request/config/service_manager.php | 10 +- .../Request/src/ConfigProvider.php | 2 +- .../ApiIdentifierUnknownException.php | 2 +- .../ApiPropertyUndefinedException.php | 2 +- .../Exception/ApiRequestFailedException.php | 2 +- .../Exception/ApiServiceUnknownException.php | 2 +- .../src/Factory/RequestServiceFactory.php | 6 +- .../Middleware/AnalyzeHeaderMiddleware.php | 10 +- .../Middleware/InternalRequestMiddleware.php | 4 +- .../Request/src/Service/RequestService.php | 12 +- .../Response/src/ErrorResponse.php | 6 +- .../Response/src/ForbiddenResponse.php | 2 +- .../Response/src/SuccessResponse.php | 2 +- .../Response/src/UnauthorizedResponse.php | 2 +- .../Session/config/service_manager.php | 4 +- .../Session/src/ConfigProvider.php | 2 +- .../src/Middleware/LoggedInUserMiddleware.php | 6 +- .../src/Middleware/SessionMiddleware.php | 14 +- .../UuidGenerator/src/UuidGenerator.php | 2 +- 195 files changed, 965 insertions(+), 1267 deletions(-) create mode 100644 bin/createApi.php create mode 100644 bin/createPipeline.php delete mode 100644 data/migrations/homepage/Version20230922101352.php delete mode 100644 data/migrations/homepage/Version20231021103120.php delete mode 100644 data/migrations/homepage/Version20231021112654.php rename data/migrations/{homepage => myTube}/Version20230922085011.php (94%) rename data/migrations/{homepage => myTube}/Version20230922092351.php (95%) rename data/migrations/{homepage => myTube}/Version20230922092754.php (95%) rename data/migrations/{homepage => myTube}/Version20230922101354.php (96%) rename data/migrations/{homepage => myTube}/Version20230922101355.php (95%) rename data/migrations/{homepage => myTube}/Version20230924113403.php (90%) create mode 100644 src/DataDomain/Business/src/Factory/MyTubeEntityManagerFactory.php delete mode 100644 src/DataDomain/Business/src/Factory/TemplateEntityManagerFactory.php create mode 100644 src/DataDomain/Business/src/Manager/MyTubeEntityManager.php delete mode 100644 src/DataDomain/Business/src/Manager/TemplateEntityManager.php delete mode 100644 src/HandlingDomain/Product/config/service_manager.php delete mode 100644 src/HandlingDomain/Product/src/Builder/ProductBuilder.php delete mode 100644 src/HandlingDomain/Product/src/ConfigProvider.php delete mode 100644 src/HandlingDomain/Product/src/Exception/ProductNotFoundByIdException.php delete mode 100644 src/HandlingDomain/Product/src/Exception/ProductWithIdentifierAlreadyExists.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommand.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommandBuilder.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommandHandler.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommand.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandBuilder.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandHandler.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommand.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommandBuilder.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommandHandler.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQuery.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryBuilder.php delete mode 100644 src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryHandler.php delete mode 100644 src/HandlingDomain/Product/src/Rule/ProductIdentifierAlreadyExistsRule.php rename src/Infrastructure/Exception/src/Exception/{TemplateException.php => MyTubeException.php} (77%) rename src/Infrastructure/Exception/src/Middleware/{TemplateExceptionHandlerMiddleware.php => MyTubeExceptionHandlerMiddleware.php} (67%) diff --git a/.env.example b/.env.example index 892e582..bf42cae 100644 --- a/.env.example +++ b/.env.example @@ -1,20 +1,13 @@ # DB Configuration DB_DRIVER=pdo_mysql -DB_HOST=template-backend-mysql +DB_HOST=myTube-backend-mysql DB_PORT=3306 -DB_USER=template +DB_USER=myTube DB_PASSWORD=pass -DB_NAME=template +DB_NAME=myTube DB_NAME_LOG=log -# API Keys -AUTH_API_KEY= -NOTIFICATION_API_KEY= -FILE_API_KEY= -HOMEPAGE_API_KEY= -BEE_API_KEY= - -# Template Setup +# MyTube Setup INIT_USER_NAME=admin INIT_USER_PASSWORD=password INIT_USER_MAIL=admin@test.com \ No newline at end of file diff --git a/bin/console.php b/bin/console.php index 151ba0e..b45642b 100644 --- a/bin/console.php +++ b/bin/console.php @@ -1,6 +1,6 @@ getBody()->getContents(), + true + ); + + \${$cqrsVariableName} = \$this->{$cqrsBuilderVariableName}->build( + \$data + ); + \$result = \$this->{$cqrsHandlerVariableName}->execute(\${$cqrsVariableName}); + + return new SuccessResponse('OK'); + } +} +"; +writeToFile($apiHandlerFilePath, $apiHandlerFileContent); + +$cqrsFileContent = " $stepClassName, + 'stepVariableName' => lcfirst($stepClassName), + 'stepFilePath' => $stepsFilePath . $stepClassName . '.php', + 'stepUsingNamespace' => 'use ' . $payloadFullNamespace . '\\Step\\' . $stepClassName, + ]; +} + + + + +########## WRITE FILES ############### +function writeToFile($path, $content) { + echo 'Writing contents to file ' . $path . PHP_EOL; + + $directory = pathinfo($path, PATHINFO_DIRNAME); + if (!is_dir($directory)) { + mkdir($directory, 0755, true); + } + + file_put_contents($path, $content); +} + +$stepsUsingNamespaces = []; +$stepsDeclarations = []; +$stepsReferences = []; + +foreach ($steps as $step) { + $stepClassName = $step['stepClassName']; + $stepVariableName = $step['stepVariableName']; + $stepFilePath = $step['stepFilePath']; + $stepUsingNamespace = $step['stepUsingNamespace']; + + $stepsUsingNamespaces[] = $stepUsingNamespace . ';'; + $stepsDeclarations[] = 'private readonly ' . $stepClassName . ' $' . $stepVariableName . ','; + $stepsReferences[] = '$this->' . $stepVariableName . ','; + + $stepFileContent = "next()(\$payload, \$pipeline); + } +} +"; + writeToFile($stepFilePath, $stepFileContent); +} + +$stepsUsingNamespace = implode(PHP_EOL, $stepsUsingNamespaces); +$stepsDeclaration = implode(PHP_EOL . ' ', $stepsDeclarations); +$stepsReference = implode(PHP_EOL . ' ', $stepsReferences); + + + +$pipelineFileContent = "setMetadataDriverImpl($driver); -$entityManager = $container->get(TemplateEntityManager::class); +$entityManager = $container->get(MyTubeEntityManager::class); try { $connection = DriverManager::getConnection($dbParams); diff --git a/bin/doctrine-migrations.php b/bin/doctrine-migrations.php index 984881f..82317f1 100644 --- a/bin/doctrine-migrations.php +++ b/bin/doctrine-migrations.php @@ -3,7 +3,7 @@ require_once __DIR__ . '/../config/autoload/defines.php'; require APP_ROOT . '/vendor/autoload.php'; -use Template\Data\Business\Manager\TemplateEntityManager; +use MyTube\Data\Business\Manager\MyTubeEntityManager; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\DBAL\DriverManager; use Doctrine\Migrations\Configuration\Configuration; @@ -30,17 +30,17 @@ $isDevMode = true; $container = require APP_ROOT . '/config/container.php'; $config = $container->get('config'); $doctrineConfig = $config['doctrine']; -$paths = $doctrineConfig['driver']['orm_template_annotation_driver']['paths']; +$paths = $doctrineConfig['driver']['orm_myTube_annotation_driver']['paths']; -$dbParams = $doctrineConfig['connection']['orm_template']['params']; -$migrationsConf = $doctrineConfig['migrations_configuration']['orm_template']; +$dbParams = $doctrineConfig['connection']['orm_myTube']['params']; +$migrationsConf = $doctrineConfig['migrations_configuration']['orm_myTube']; $reader = new AnnotationReader(); $driver = new AnnotationDriver($reader, $paths); $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); $config->setMetadataDriverImpl($driver); -$entityManager = $container->get(TemplateEntityManager::class); +$entityManager = $container->get(MyTubeEntityManager::class); try { $connection = DriverManager::getConnection($dbParams); diff --git a/bin/script/init b/bin/script/init index 413fc2d..5ba2fe5 100755 --- a/bin/script/init +++ b/bin/script/init @@ -21,12 +21,12 @@ $SCRIPT_DIR/exec up -d source $ENV_DIR/bin/script/drun # Install PHP packages -drun template-backend composer install +drun myTube-backend composer install # Migrate databases to current version -drun template-backend composer dmm -drun template-backend composer dmlm +drun myTube-backend composer dmm +drun myTube-backend composer dmlm # Insert setup for project after this line -drun template-backend composer console rbac:update -drun template-backend composer console init:data \ No newline at end of file +drun myTube-backend composer console rbac:update +drun myTube-backend composer console init:data \ No newline at end of file diff --git a/composer.development.json b/composer.development.json index bd0d9df..eb2f67f 100644 --- a/composer.development.json +++ b/composer.development.json @@ -19,50 +19,50 @@ "monolog\/monolog": "^3.4", "laminas\/laminas-mail": "^2.23", "teewurst\/pipeline": "^3.0", - "guzzlehttp\/guzzle": "^7.8" + "guzzlehttp\/guzzle": "^7.8", + "micilini\/video-stream": "*" }, "autoload": { "psr-4": { - "Template\\API\\Console\\": "src\/ApiDomain\/Console\/src", - "Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", - "Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", - "Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", - "Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", - "Template\\Data\\Business\\": "src\/DataDomain\/Business\/src", - "Template\\Data\\Log\\": "src\/DataDomain\/Log\/src", - "Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", - "Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", - "Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", - "Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src", - "Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", - "Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", - "Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", - "Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", - "Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", - "Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", - "Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", - "Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", - "Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", - "Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", - "Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" + "MyTube\\API\\Console\\": "src\/ApiDomain\/Console\/src", + "MyTube\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", + "MyTube\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", + "MyTube\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", + "MyTube\\Data\\Business\\": "src\/DataDomain\/Business\/src", + "MyTube\\Data\\Log\\": "src\/DataDomain\/Log\/src", + "MyTube\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", + "MyTube\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", + "MyTube\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", + "MyTube\\Handling\\User\\": "src\/HandlingDomain\/User\/src", + "MyTube\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", + "MyTube\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", + "MyTube\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", + "MyTube\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", + "MyTube\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", + "MyTube\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", + "MyTube\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", + "MyTube\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", + "MyTube\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", + "MyTube\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", + "MyTube\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" } }, "extra": { "teewurst\/psr4-advanced-wildcard-composer-plugin": { "autoload": { "psr-4": { - "Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", - "Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", - "Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", - "Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" + "MyTube\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", + "MyTube\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", + "MyTube\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", + "MyTube\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" } }, "autoload-dev": { "psr-4": { - "Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", - "Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", - "Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", - "Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" + "MyTube\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", + "MyTube\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", + "MyTube\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", + "MyTube\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" } } } @@ -96,27 +96,26 @@ }, "autoload-dev": { "psr-4": { - "Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", - "Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", - "Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", - "Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", - "Template\\Data\\Business\\": "src\/DataDomain\/Business\/src", - "Template\\Data\\Log\\": "src\/DataDomain\/Log\/src", - "Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", - "Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", - "Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", - "Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src", - "Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", - "Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", - "Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", - "Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", - "Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", - "Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", - "Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", - "Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", - "Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", - "Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", - "Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" + "MyTube\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", + "MyTube\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", + "MyTube\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", + "MyTube\\Data\\Business\\": "src\/DataDomain\/Business\/src", + "MyTube\\Data\\Log\\": "src\/DataDomain\/Log\/src", + "MyTube\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", + "MyTube\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", + "MyTube\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", + "MyTube\\Handling\\User\\": "src\/HandlingDomain\/User\/src", + "MyTube\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", + "MyTube\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", + "MyTube\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", + "MyTube\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", + "MyTube\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", + "MyTube\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", + "MyTube\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", + "MyTube\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", + "MyTube\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", + "MyTube\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", + "MyTube\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" } } } \ No newline at end of file diff --git a/composer.json b/composer.json index cbb6b4f..b97bbf4 100644 --- a/composer.json +++ b/composer.json @@ -19,29 +19,30 @@ "monolog/monolog": "^3.4", "laminas/laminas-mail": "^2.23", "teewurst/pipeline": "^3.0", - "guzzlehttp/guzzle": "^7.8" + "guzzlehttp/guzzle": "^7.8", + "micilini/video-stream": "^1.0" }, "autoload": { "psr-4": { - "Template\\API\\Console\\": "src/ApiDomain/Console/src/" + "MyTube\\API\\Console\\": "src/ApiDomain/Console/src/" } }, "extra": { "teewurst/psr4-advanced-wildcard-composer-plugin": { "autoload": { "psr-4": { - "Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", - "Template\\Data\\%s\\": "src/DataDomain/{*}/src/", - "Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", - "Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" + "MyTube\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", + "MyTube\\Data\\%s\\": "src/DataDomain/{*}/src/", + "MyTube\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", + "MyTube\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" } }, "autoload-dev": { "psr-4": { - "Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", - "Template\\Data\\%s\\": "src/DataDomain/{*}/src/", - "Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", - "Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" + "MyTube\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", + "MyTube\\Data\\%s\\": "src/DataDomain/{*}/src/", + "MyTube\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", + "MyTube\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" } } } diff --git a/config/autoload/api.global.php b/config/autoload/api.global.php index 35e85c3..bc0c3b9 100644 --- a/config/autoload/api.global.php +++ b/config/autoload/api.global.php @@ -3,13 +3,13 @@ return [ 'api' => [ 'keys' => [ - 'template' => $_ENV['HOMEPAGE_API_KEY'], + 'myTube' => $_ENV['HOMEPAGE_API_KEY'], 'notification' => $_ENV['NOTIFICATION_API_KEY'], ], 'services' => [ - 'template' => [ - 'host' => 'template-backend-nginx', + 'myTube' => [ + 'host' => 'myTube-backend-nginx', 'apis' => [ ] diff --git a/config/autoload/authorization.global.php b/config/autoload/authorization.global.php index d1b8b23..4c9cf75 100644 --- a/config/autoload/authorization.global.php +++ b/config/autoload/authorization.global.php @@ -1,7 +1,7 @@ [ + 'myTube-rbac' => [ 'roles' => [ 'admin', 'user', diff --git a/config/autoload/logger.global.php b/config/autoload/logger.global.php index 3a3fee7..9c5cf69 100644 --- a/config/autoload/logger.global.php +++ b/config/autoload/logger.global.php @@ -6,8 +6,8 @@ use Monolog\Level; return [ 'logger' => [ - 'name' => 'template.backend', - 'path' => APP_ROOT . '/var/log/template.backend.log', + 'name' => 'myTube.backend', + 'path' => APP_ROOT . '/var/log/myTube.backend.log', 'level' => Level::Debug, 'pretty' => true, ] diff --git a/config/autoload/mezzio.global.php b/config/autoload/mezzio.global.php index b6b10d1..20e3526 100644 --- a/config/autoload/mezzio.global.php +++ b/config/autoload/mezzio.global.php @@ -11,14 +11,14 @@ return [ // `composer clear-config-cache`. ConfigAggregator::ENABLE_CACHE => false, - // Enable debugging; typically used to provide debugging information within templates. + // Enable debugging; typically used to provide debugging information within myTubes. 'debug' => false, 'mezzio' => [ - // Provide templates for the error handling middleware to use when + // Provide myTubes for the error handling middleware to use when // generating responses. 'error_handler' => [ - 'template_404' => 'error::404', - 'template_error' => 'error::error', + 'myTube_404' => 'error::404', + 'myTube_error' => 'error::error', ], ], ]; diff --git a/config/config.php b/config/config.php index 8d3f7dd..795729d 100644 --- a/config/config.php +++ b/config/config.php @@ -40,34 +40,32 @@ $aggregator = new ConfigAggregator([ // Data - \Template\Data\Business\ConfigProvider::class, - \Template\Data\Log\ConfigProvider::class, + \MyTube\Data\Business\ConfigProvider::class, + \MyTube\Data\Log\ConfigProvider::class, // Infrastructure - \Template\Infrastructure\Database\ConfigProvider::class, - \Template\Infrastructure\DependencyInjection\ConfigProvider::class, - \Template\Infrastructure\Encryption\ConfigProvider::class, - \Template\Infrastructure\Exception\ConfigProvider::class, - \Template\Infrastructure\Logging\ConfigProvider::class, - \Template\Infrastructure\Rbac\ConfigProvider::class, - \Template\Infrastructure\Request\ConfigProvider::class, - \Template\Infrastructure\Session\ConfigProvider::class, + \MyTube\Infrastructure\Database\ConfigProvider::class, + \MyTube\Infrastructure\DependencyInjection\ConfigProvider::class, + \MyTube\Infrastructure\Encryption\ConfigProvider::class, + \MyTube\Infrastructure\Exception\ConfigProvider::class, + \MyTube\Infrastructure\Logging\ConfigProvider::class, + \MyTube\Infrastructure\Rbac\ConfigProvider::class, + \MyTube\Infrastructure\Request\ConfigProvider::class, + \MyTube\Infrastructure\Session\ConfigProvider::class, // HandlingDomain - \Template\Handling\Product\ConfigProvider::class, - \Template\Handling\User\ConfigProvider::class, - \Template\Handling\UserSession\ConfigProvider::class, - \Template\Handling\Registration\ConfigProvider::class, + \MyTube\Handling\User\ConfigProvider::class, + \MyTube\Handling\UserSession\ConfigProvider::class, + \MyTube\Handling\Registration\ConfigProvider::class, // API /// Command - \Template\API\Console\ConfigProvider::class, + \MyTube\API\Console\ConfigProvider::class, /// External - \Template\API\External\Health\ConfigProvider::class, - \Template\API\External\Product\ConfigProvider::class, - \Template\API\External\User\ConfigProvider::class, - \Template\API\External\Authentication\ConfigProvider::class, + \MyTube\API\External\Health\ConfigProvider::class, + \MyTube\API\External\User\ConfigProvider::class, + \MyTube\API\External\Authentication\ConfigProvider::class, /// Internal diff --git a/config/pipeline.php b/config/pipeline.php index f9ee865..40983cf 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware; -use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; -use Template\Infrastructure\Session\Middleware\SessionMiddleware; +use MyTube\Infrastructure\Exception\Middleware\MyTubeExceptionHandlerMiddleware; +use MyTube\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; +use MyTube\Infrastructure\Session\Middleware\SessionMiddleware; use Laminas\Stratigility\Middleware\ErrorHandler; use Mezzio\Application; use Mezzio\Handler\NotFoundHandler; @@ -66,11 +66,11 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac - //// Pre Template Space - $app->pipe(TemplateExceptionHandlerMiddleware::class); + //// Pre MyTube Space + $app->pipe(MyTubeExceptionHandlerMiddleware::class); $app->pipe(AnalyzeHeaderMiddleware::class); - //// Template Space + //// MyTube Space $app->pipe(SessionMiddleware::class); diff --git a/config/routes.php b/config/routes.php index a2523a1..054a32d 100644 --- a/config/routes.php +++ b/config/routes.php @@ -5,7 +5,7 @@ declare(strict_types=1); use Mezzio\Application; use Mezzio\MiddlewareFactory; use Psr\Container\ContainerInterface; -use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; +use MyTube\Infrastructure\Session\Middleware\LoggedInUserMiddleware; /** * laminas-router route configuration diff --git a/data/migrations/homepage/Version20230922101352.php b/data/migrations/homepage/Version20230922101352.php deleted file mode 100644 index 44fe20f..0000000 --- a/data/migrations/homepage/Version20230922101352.php +++ /dev/null @@ -1,38 +0,0 @@ -addSql($sql); - } - - public function down(Schema $schema): void - { - $this->addSql("DROP TABLE product;"); - } -} diff --git a/data/migrations/homepage/Version20231021103120.php b/data/migrations/homepage/Version20231021103120.php deleted file mode 100644 index 5392834..0000000 --- a/data/migrations/homepage/Version20231021103120.php +++ /dev/null @@ -1,33 +0,0 @@ -addSql($sql); - } - - public function down(Schema $schema): void - { - $sql = "ALTER TABLE registration ADD COLUMN password varchar(255) NOT NULL after username"; - - $this->addSql($sql); - } -} diff --git a/data/migrations/homepage/Version20231021112654.php b/data/migrations/homepage/Version20231021112654.php deleted file mode 100644 index efcc53d..0000000 --- a/data/migrations/homepage/Version20231021112654.php +++ /dev/null @@ -1,33 +0,0 @@ -addSql($sql); - } - - public function down(Schema $schema): void - { - $sql = "ALTER TABLE product DROP COLUMN url;"; - - $this->addSql($sql); - } -} diff --git a/data/migrations/log/Version20230922150649.php b/data/migrations/log/Version20230922150649.php index bbc7eae..993e73c 100644 --- a/data/migrations/log/Version20230922150649.php +++ b/data/migrations/log/Version20230922150649.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Log; +namespace MyTube\Migrations\Log; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230922085011.php b/data/migrations/myTube/Version20230922085011.php similarity index 94% rename from data/migrations/homepage/Version20230922085011.php rename to data/migrations/myTube/Version20230922085011.php index 0784eb9..1b20004 100644 --- a/data/migrations/homepage/Version20230922085011.php +++ b/data/migrations/myTube/Version20230922085011.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230922092351.php b/data/migrations/myTube/Version20230922092351.php similarity index 95% rename from data/migrations/homepage/Version20230922092351.php rename to data/migrations/myTube/Version20230922092351.php index ca2c727..366d65e 100644 --- a/data/migrations/homepage/Version20230922092351.php +++ b/data/migrations/myTube/Version20230922092351.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230922092754.php b/data/migrations/myTube/Version20230922092754.php similarity index 95% rename from data/migrations/homepage/Version20230922092754.php rename to data/migrations/myTube/Version20230922092754.php index 2bbcb56..0b4b9e2 100644 --- a/data/migrations/homepage/Version20230922092754.php +++ b/data/migrations/myTube/Version20230922092754.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230922101354.php b/data/migrations/myTube/Version20230922101354.php similarity index 96% rename from data/migrations/homepage/Version20230922101354.php rename to data/migrations/myTube/Version20230922101354.php index 51cfcd8..6c19b61 100644 --- a/data/migrations/homepage/Version20230922101354.php +++ b/data/migrations/myTube/Version20230922101354.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230922101355.php b/data/migrations/myTube/Version20230922101355.php similarity index 95% rename from data/migrations/homepage/Version20230922101355.php rename to data/migrations/myTube/Version20230922101355.php index 296a9de..f4b2e3f 100644 --- a/data/migrations/homepage/Version20230922101355.php +++ b/data/migrations/myTube/Version20230922101355.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/data/migrations/homepage/Version20230924113403.php b/data/migrations/myTube/Version20230924113403.php similarity index 90% rename from data/migrations/homepage/Version20230924113403.php rename to data/migrations/myTube/Version20230924113403.php index 40fe724..c7245c5 100644 --- a/data/migrations/homepage/Version20230924113403.php +++ b/data/migrations/myTube/Version20230924113403.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Migrations\Template; +namespace MyTube\Migrations\MyTube; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -23,7 +23,6 @@ final class Version20230924113403 extends AbstractMigration id binary(16) NOT NULL, mail varchar(255) NOT NULL, username varchar(255) NOT NULL, - password varchar(255) NOT NULL, created_at datetime NOT NULL, PRIMARY KEY (id) );"; diff --git a/docker/docker-compose-mac.yml b/docker/docker-compose-mac.yml index 1f1da0c..d2dc212 100644 --- a/docker/docker-compose-mac.yml +++ b/docker/docker-compose-mac.yml @@ -1,18 +1,18 @@ version: '3' networks: - template: + myTube: external: true services: - template-backend-mysql: - image: template-backend-mysql + myTube-backend-mysql: + image: myTube-backend-mysql networks: - - template + - myTube build: context: ./../ dockerfile: ./docker/mysql/dockerfile volumes: - - /Users/flo/dev/backend/template/var/db:/var/lib/mysql:z + - /Users/flo/dev/backend/myTube/var/db:/var/lib/mysql:z environment: MYSQL_USER: ${DB_USER} MYSQL_PASSWORD: ${DB_PASSWORD} @@ -23,29 +23,29 @@ services: timeout: 20s retries: 10 - template-backend-app: - image: template-backend-app + myTube-backend-app: + image: myTube-backend-app networks: - - template + - myTube build: context: ./../ dockerfile: ./docker/php/dockerfile volumes: - - /Users/flo/dev/backend/template/:/var/www/html:z + - /Users/flo/dev/backend/myTube/:/var/www/html:z ports: - 9000:9000 depends_on: - template-backend-mysql: + myTube-backend-mysql: condition: service_healthy - template-backend-nginx: - image: template-backend-nginx + myTube-backend-nginx: + image: myTube-backend-nginx networks: - - template + - myTube build: context: ./../ dockerfile: ./docker/nginx/dockerfile ports: - 8080:80 depends_on: - - template-backend-app \ No newline at end of file + - myTube-backend-app \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 094d233..f5a39a0 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,13 +1,13 @@ version: '3' networks: - template: + mytube: external: true services: - template-backend-mysql: - image: template-backend-mysql + mytube-backend-mysql: + image: mytube-backend-mysql networks: - - template + - mytube build: context: ./../ dockerfile: ./docker/mysql/dockerfile @@ -23,10 +23,10 @@ services: timeout: 20s retries: 10 - template-backend-app: - image: template-backend-app + mytube-backend-app: + image: mytube-backend-app networks: - - template + - mytube build: context: ./../ dockerfile: ./docker/php/dockerfile @@ -35,17 +35,17 @@ services: ports: - 9000:9000 depends_on: - template-backend-mysql: + mytube-backend-mysql: condition: service_healthy - template-backend-nginx: - image: template-backend-nginx + mytube-backend-nginx: + image: mytube-backend-nginx networks: - - template + - mytube build: context: ./../ dockerfile: ./docker/nginx/dockerfile ports: - 8080:80 depends_on: - - template-backend-app \ No newline at end of file + - mytube-backend-app \ No newline at end of file diff --git a/docker/mysql/scripts/initdb.sql b/docker/mysql/scripts/initdb.sql index 206f6e9..ed527bc 100644 --- a/docker/mysql/scripts/initdb.sql +++ b/docker/mysql/scripts/initdb.sql @@ -1,4 +1,4 @@ CREATE DATABASE IF NOT EXISTS `log`; -CREATE DATABASE IF NOT EXISTS `template`; +CREATE DATABASE IF NOT EXISTS `myTube`; -GRANT ALL PRIVILEGES on *.* to 'template'@'%'; \ No newline at end of file +GRANT ALL PRIVILEGES on *.* to 'myTube'@'%'; \ No newline at end of file diff --git a/docker/nginx/config/nginx.conf b/docker/nginx/config/nginx.conf index 16cb672..a970480 100644 --- a/docker/nginx/config/nginx.conf +++ b/docker/nginx/config/nginx.conf @@ -1,5 +1,5 @@ upstream host-backend-app { - server template-backend-app:9000; + server myTube-backend-app:9000; } server { diff --git a/src/ApiDomain/Console/config/console.php b/src/ApiDomain/Console/config/console.php index 20093d4..7c6b749 100644 --- a/src/ApiDomain/Console/config/console.php +++ b/src/ApiDomain/Console/config/console.php @@ -1,7 +1,7 @@ [ diff --git a/src/ApiDomain/Console/config/service_manager.php b/src/ApiDomain/Console/config/service_manager.php index 9aa3afc..00ff486 100644 --- a/src/ApiDomain/Console/config/service_manager.php +++ b/src/ApiDomain/Console/config/service_manager.php @@ -1,7 +1,7 @@ getName()); diff --git a/src/ApiDomain/Console/src/Command/RbacUpdateCommand.php b/src/ApiDomain/Console/src/Command/RbacUpdateCommand.php index ebee2fb..924494d 100644 --- a/src/ApiDomain/Console/src/Command/RbacUpdateCommand.php +++ b/src/ApiDomain/Console/src/Command/RbacUpdateCommand.php @@ -1,13 +1,13 @@ getName()); @@ -32,7 +32,7 @@ class RbacUpdateCommand extends Command $this->roleRepository = $this->entityManager->getRepository(Role::class); $this->permissionRepository = $this->entityManager->getRepository(Permission::class); - $this->rbacConfig = $this->configService->resolve('template-rbac')->toArray(); + $this->rbacConfig = $this->configService->resolve('myTube-rbac')->toArray(); } protected function execute( diff --git a/src/ApiDomain/Console/src/ConfigProvider.php b/src/ApiDomain/Console/src/ConfigProvider.php index e9a5efc..f09ed3b 100644 --- a/src/ApiDomain/Console/src/ConfigProvider.php +++ b/src/ApiDomain/Console/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\API\Console; +namespace MyTube\API\Console; class ConfigProvider { diff --git a/src/ApiDomain/External/Authentication/config/routes.php b/src/ApiDomain/External/Authentication/config/routes.php index b776574..bf8cc8d 100644 --- a/src/ApiDomain/External/Authentication/config/routes.php +++ b/src/ApiDomain/External/Authentication/config/routes.php @@ -1,10 +1,10 @@ [ - 'orm_template' => [ + 'orm_myTube' => [ 'second_level_cache' => [ 'enabled' => false, ] @@ -14,7 +14,7 @@ return [ ], 'driver' => [ - 'orm_template_annotation_driver' => [ + 'orm_myTube_annotation_driver' => [ 'class' => AnnotationDriver::class, 'cache' => 'array', 'paths' => [ @@ -22,16 +22,16 @@ return [ ], ], - 'orm_template' => [ + 'orm_myTube' => [ 'class' => MappingDriverChain::class, 'drivers' => [ - 'Template\Data\Business\Entity' => 'orm_template_annotation_driver', + 'MyTube\Data\Business\Entity' => 'orm_myTube_annotation_driver', ], ], ], 'connection' => [ - 'orm_template' => [ + 'orm_myTube' => [ 'driverClass' => Driver::class, 'params' => [ 'driver' => $_ENV['DB_DRIVER'], @@ -45,10 +45,10 @@ return [ ], 'migrations_configuration' => [ - 'orm_template' => [ - 'directory' => 'data/migrations/template', - 'name' => 'Doctrine Database Migrations for Template', - 'namespace' => 'Template\Migrations\Template', + 'orm_myTube' => [ + 'directory' => 'data/migrations/myTube', + 'name' => 'Doctrine Database Migrations for MyTube', + 'namespace' => 'MyTube\Migrations\MyTube', 'table' => 'migrations', ], ], diff --git a/src/DataDomain/Business/config/service_manager.php b/src/DataDomain/Business/config/service_manager.php index a4c36f2..46e48f6 100644 --- a/src/DataDomain/Business/config/service_manager.php +++ b/src/DataDomain/Business/config/service_manager.php @@ -1,21 +1,21 @@ [ - 'doctrine.entity_manager.orm_template' => [EntityManagerFactory::class, 'orm_template'], - 'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'], - 'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'], - TemplateEntityManager::class => TemplateEntityManagerFactory::class, + 'doctrine.entity_manager.orm_myTube' => [EntityManagerFactory::class, 'orm_myTube'], + 'doctrine.configuration.orm_myTube' => [ConfigurationFactory::class, 'orm_myTube'], + 'doctrine.connection.orm_myTube' => [ConnectionFactory::class, 'orm_myTube'], + MyTubeEntityManager::class => MyTubeEntityManagerFactory::class, - UserRepository::class => [AutowireRepositoryFactory::class, TemplateEntityManager::class, User::class], + UserRepository::class => [AutowireRepositoryFactory::class, MyTubeEntityManager::class, User::class], ], ]; diff --git a/src/DataDomain/Business/src/ConfigProvider.php b/src/DataDomain/Business/src/ConfigProvider.php index e3b2c68..3b28200 100644 --- a/src/DataDomain/Business/src/ConfigProvider.php +++ b/src/DataDomain/Business/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Data\Business; +namespace MyTube\Data\Business; class ConfigProvider { diff --git a/src/DataDomain/Business/src/Entity/Permission.php b/src/DataDomain/Business/src/Entity/Permission.php index 5db6c05..d4efa8f 100644 --- a/src/DataDomain/Business/src/Entity/Permission.php +++ b/src/DataDomain/Business/src/Entity/Permission.php @@ -1,15 +1,15 @@ get('doctrine.entity_manager.orm_myTube') + ); + } +} diff --git a/src/DataDomain/Business/src/Factory/TemplateEntityManagerFactory.php b/src/DataDomain/Business/src/Factory/TemplateEntityManagerFactory.php deleted file mode 100644 index 5889a30..0000000 --- a/src/DataDomain/Business/src/Factory/TemplateEntityManagerFactory.php +++ /dev/null @@ -1,19 +0,0 @@ -get('doctrine.entity_manager.orm_template') - ); - } -} diff --git a/src/DataDomain/Business/src/Manager/MyTubeEntityManager.php b/src/DataDomain/Business/src/Manager/MyTubeEntityManager.php new file mode 100644 index 0000000..48529b8 --- /dev/null +++ b/src/DataDomain/Business/src/Manager/MyTubeEntityManager.php @@ -0,0 +1,11 @@ + [ 'class' => MappingDriverChain::class, 'drivers' => [ - 'Template\Data\Log\Entity' => 'orm_log_annotation_driver', + 'MyTube\Data\Log\Entity' => 'orm_log_annotation_driver', ], ], ], @@ -48,7 +48,7 @@ return [ 'orm_log' => [ 'directory' => 'data/migrations/log', 'name' => 'Doctrine Database Migrations for Log', - 'namespace' => 'Template\Migrations\Log', + 'namespace' => 'MyTube\Migrations\Log', 'table' => 'migrations', ], ], diff --git a/src/DataDomain/Log/config/service_manager.php b/src/DataDomain/Log/config/service_manager.php index 3357574..3eb42ce 100644 --- a/src/DataDomain/Log/config/service_manager.php +++ b/src/DataDomain/Log/config/service_manager.php @@ -1,7 +1,7 @@ [ - - /// Builder - ProductBuilder::class => AutoWiringFactory::class, - - /// Rule - ProductIdentifierAlreadyExistsRule::class => InjectionFactory::class, - - /// CQRS - // Product List - ProductListQueryHandler::class => InjectionFactory::class, - ProductListQueryBuilder::class => AutoWiringFactory::class, - - // Create Product - CreateProductCommandHandler::class => AutoWiringFactory::class, - CreateProductCommandBuilder::class => AutoWiringFactory::class, - - // Delete Product - DeleteProductCommandHandler::class => InjectionFactory::class, - DeleteProductCommandBuilder::class => AutoWiringFactory::class, - - // Update Product - UpdateProductCommandHandler::class => InjectionFactory::class, - UpdateProductCommandBuilder::class => AutoWiringFactory::class, - - ], -]; \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Builder/ProductBuilder.php b/src/HandlingDomain/Product/src/Builder/ProductBuilder.php deleted file mode 100644 index f79f0f1..0000000 --- a/src/HandlingDomain/Product/src/Builder/ProductBuilder.php +++ /dev/null @@ -1,23 +0,0 @@ -setIdentifier($identifier); - $product->setName($name); - $product->setUrl($url); - - return $product; - } -} \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/ConfigProvider.php b/src/HandlingDomain/Product/src/ConfigProvider.php deleted file mode 100644 index 2f68801..0000000 --- a/src/HandlingDomain/Product/src/ConfigProvider.php +++ /dev/null @@ -1,15 +0,0 @@ - require __DIR__ . '/./../config/service_manager.php', - ]; - } -} diff --git a/src/HandlingDomain/Product/src/Exception/ProductNotFoundByIdException.php b/src/HandlingDomain/Product/src/Exception/ProductNotFoundByIdException.php deleted file mode 100644 index c2ed05b..0000000 --- a/src/HandlingDomain/Product/src/Exception/ProductNotFoundByIdException.php +++ /dev/null @@ -1,27 +0,0 @@ -toString() - ), - ErrorDomain::Product, - ErrorCode::NotFound - ); - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Exception/ProductWithIdentifierAlreadyExists.php b/src/HandlingDomain/Product/src/Exception/ProductWithIdentifierAlreadyExists.php deleted file mode 100644 index 388020a..0000000 --- a/src/HandlingDomain/Product/src/Exception/ProductWithIdentifierAlreadyExists.php +++ /dev/null @@ -1,24 +0,0 @@ -identifier; - } - - public function getName(): ?string { - return $this->name; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommandBuilder.php b/src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommandBuilder.php deleted file mode 100644 index 0618d65..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/CreateProduct/CreateProductCommandBuilder.php +++ /dev/null @@ -1,17 +0,0 @@ -productIdentifierAlreadyExistsRule->appliesTo($command->getIdentifier()); - - $product = $this->builder->build( - identifier: $command->getIdentifier(), - name: $command->getName(), - url: null, - ); - - $this->entityManager->persist($product); - $this->entityManager->flush(); - - return $product; - } -} diff --git a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommand.php b/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommand.php deleted file mode 100644 index 736313e..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommand.php +++ /dev/null @@ -1,19 +0,0 @@ -id; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandBuilder.php b/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandBuilder.php deleted file mode 100644 index 5d6301d..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandBuilder.php +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandHandler.php b/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandHandler.php deleted file mode 100644 index 40a7398..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/DeleteProduct/DeleteProductCommandHandler.php +++ /dev/null @@ -1,39 +0,0 @@ -repository->find( - $command->getId() - ) ?? null; - - if ($product === null) { - throw new ProductNotFoundByIdException($command->getId()); - } - - $this->entityManager->remove($product); - $this->entityManager->flush(); - } -} diff --git a/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommand.php b/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommand.php deleted file mode 100644 index 265fe2a..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommand.php +++ /dev/null @@ -1,32 +0,0 @@ -id; - } - - public function getIdentifier(): string { - return $this->identifier; - } - - public function getName(): ?string { - return $this->name; - } - - public function getUrl(): ?string { - return $this->url; - } -} diff --git a/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommandBuilder.php b/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommandBuilder.php deleted file mode 100644 index fa006f8..0000000 --- a/src/HandlingDomain/Product/src/Handler/Command/UpdateProduct/UpdateProductCommandBuilder.php +++ /dev/null @@ -1,23 +0,0 @@ -getId(); - - /** @var Product $product */ - $product = $this->repository->find($id) ?? null; - if ($product === null) { - throw new ProductNotFoundByIdException($id); - } - - if ($product->getId()->toString() !== $command->getId()->toString()) { - $this->productIdentifierAlreadyExistsRule->appliesTo($command->getIdentifier()); - } - - $product->setIdentifier($command->getIdentifier()); - $product->setName($command->getName()); - $product->setUrl($command->getUrl()); - $product->setUpdatedAt(new DateTime()); - - $this->entityManager->persist($product); - $this->entityManager->flush(); - - return $product; - } -} diff --git a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQuery.php b/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQuery.php deleted file mode 100644 index de4e49f..0000000 --- a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQuery.php +++ /dev/null @@ -1,17 +0,0 @@ -query; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryBuilder.php b/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryBuilder.php deleted file mode 100644 index a538e3e..0000000 --- a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ - \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryHandler.php b/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryHandler.php deleted file mode 100644 index 6ed206f..0000000 --- a/src/HandlingDomain/Product/src/Handler/Query/ProductList/ProductListQueryHandler.php +++ /dev/null @@ -1,29 +0,0 @@ -repository->findAll(); - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Product/src/Rule/ProductIdentifierAlreadyExistsRule.php b/src/HandlingDomain/Product/src/Rule/ProductIdentifierAlreadyExistsRule.php deleted file mode 100644 index 1a5ca36..0000000 --- a/src/HandlingDomain/Product/src/Rule/ProductIdentifierAlreadyExistsRule.php +++ /dev/null @@ -1,33 +0,0 @@ -productRepository->findOneBy([ - 'identifier' => $identifier - ]) ?? null; - - if ($product !== null) { - throw new ProductWithIdentifierAlreadyExists($identifier); - } - } -} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/config/service_manager.php b/src/HandlingDomain/Registration/config/service_manager.php index 4d80c4c..463d3e4 100644 --- a/src/HandlingDomain/Registration/config/service_manager.php +++ b/src/HandlingDomain/Registration/config/service_manager.php @@ -1,20 +1,20 @@ 'new-account', + 'myTube-identifier' => 'new-account', 'sender' => 'info@stack-up.de', 'recipient' => $command->getMail(), 'data' => [ diff --git a/src/HandlingDomain/Registration/src/Rule/RegistrationWithIdentifierAlreadyExistsRule.php b/src/HandlingDomain/Registration/src/Rule/RegistrationWithIdentifierAlreadyExistsRule.php index 5332ffd..3f57b7b 100644 --- a/src/HandlingDomain/Registration/src/Rule/RegistrationWithIdentifierAlreadyExistsRule.php +++ b/src/HandlingDomain/Registration/src/Rule/RegistrationWithIdentifierAlreadyExistsRule.php @@ -1,17 +1,17 @@ [ - TemplateExceptionHandlerMiddleware::class => AutoWiringFactory::class, + MyTubeExceptionHandlerMiddleware::class => AutoWiringFactory::class, ], ]; diff --git a/src/Infrastructure/Exception/src/ConfigProvider.php b/src/Infrastructure/Exception/src/ConfigProvider.php index 96b4859..4743811 100644 --- a/src/Infrastructure/Exception/src/ConfigProvider.php +++ b/src/Infrastructure/Exception/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Infrastructure\Exception; +namespace MyTube\Infrastructure\Exception; class ConfigProvider { diff --git a/src/Infrastructure/Exception/src/ErrorCode.php b/src/Infrastructure/Exception/src/ErrorCode.php index 72ad4d4..45f6947 100644 --- a/src/Infrastructure/Exception/src/ErrorCode.php +++ b/src/Infrastructure/Exception/src/ErrorCode.php @@ -1,6 +1,6 @@ handle($request); - } catch (TemplateException $exception) { + } catch (MyTubeException $exception) { $this->logger->exception($exception); return new ErrorResponse( diff --git a/src/Infrastructure/Logging/config/service_manager.php b/src/Infrastructure/Logging/config/service_manager.php index e31c445..b9a6d73 100644 --- a/src/Infrastructure/Logging/config/service_manager.php +++ b/src/Infrastructure/Logging/config/service_manager.php @@ -2,19 +2,19 @@ declare(strict_types=1); -use Template\Infrastructure\Logging\Factory\FileStreamHandlerFactory; -use Template\Infrastructure\Logging\Factory\LoggerFactory; -use Template\Infrastructure\Logging\Factory\MonologLoggerFactory; -use Template\Infrastructure\Logging\Handler\DoctrineLogHandler; -use Template\Infrastructure\Logging\Handler\FileStreamHandler; -use Template\Infrastructure\Logging\Logger\Logger as TemplateLogger; +use MyTube\Infrastructure\Logging\Factory\FileStreamHandlerFactory; +use MyTube\Infrastructure\Logging\Factory\LoggerFactory; +use MyTube\Infrastructure\Logging\Factory\MonologLoggerFactory; +use MyTube\Infrastructure\Logging\Handler\DoctrineLogHandler; +use MyTube\Infrastructure\Logging\Handler\FileStreamHandler; +use MyTube\Infrastructure\Logging\Logger\Logger as MyTubeLogger; use Monolog\Logger; use Monolog\Processor\PsrLogMessageProcessor; use Reinfi\DependencyInjection\Factory\AutoWiringFactory; return [ 'factories' => [ - TemplateLogger::class => LoggerFactory::class, + MyTubeLogger::class => LoggerFactory::class, Logger::class => MonologLoggerFactory::class, FileStreamHandler::class => FileStreamHandlerFactory::class, DoctrineLogHandler::class => AutoWiringFactory::class, diff --git a/src/Infrastructure/Logging/src/ConfigProvider.php b/src/Infrastructure/Logging/src/ConfigProvider.php index 7272673..7a2ddae 100644 --- a/src/Infrastructure/Logging/src/ConfigProvider.php +++ b/src/Infrastructure/Logging/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Infrastructure\Logging; +namespace MyTube\Infrastructure\Logging; class ConfigProvider { diff --git a/src/Infrastructure/Logging/src/Factory/FileStreamHandlerFactory.php b/src/Infrastructure/Logging/src/Factory/FileStreamHandlerFactory.php index ff50634..2273ab3 100644 --- a/src/Infrastructure/Logging/src/Factory/FileStreamHandlerFactory.php +++ b/src/Infrastructure/Logging/src/Factory/FileStreamHandlerFactory.php @@ -1,8 +1,8 @@ get(Logger::class) ); } diff --git a/src/Infrastructure/Logging/src/Factory/MonologLoggerFactory.php b/src/Infrastructure/Logging/src/Factory/MonologLoggerFactory.php index a493539..fff8fb0 100644 --- a/src/Infrastructure/Logging/src/Factory/MonologLoggerFactory.php +++ b/src/Infrastructure/Logging/src/Factory/MonologLoggerFactory.php @@ -1,9 +1,9 @@ $exception->getTraceAsString() ]*/; - if ($exception instanceof TemplateException) { + if ($exception instanceof MyTubeException) { $exceptionContext = array_merge([ 'errorDomain' => $exception->getErrorDomain()->value, 'errorCode' => $exception->getErrorCode()->value, diff --git a/src/Infrastructure/Rbac/config/service_manager.php b/src/Infrastructure/Rbac/config/service_manager.php index b231742..7dd958c 100644 --- a/src/Infrastructure/Rbac/config/service_manager.php +++ b/src/Infrastructure/Rbac/config/service_manager.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Template\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware; +use MyTube\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware; use Reinfi\DependencyInjection\Factory\InjectionFactory; return [ diff --git a/src/Infrastructure/Rbac/src/ConfigProvider.php b/src/Infrastructure/Rbac/src/ConfigProvider.php index 582ca7d..65ae52e 100644 --- a/src/Infrastructure/Rbac/src/ConfigProvider.php +++ b/src/Infrastructure/Rbac/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Template\Infrastructure\Rbac; +namespace MyTube\Infrastructure\Rbac; class ConfigProvider { diff --git a/src/Infrastructure/Rbac/src/Middleware/EnsureAuthorizationMiddleware.php b/src/Infrastructure/Rbac/src/Middleware/EnsureAuthorizationMiddleware.php index d3b9581..8fc7a99 100644 --- a/src/Infrastructure/Rbac/src/Middleware/EnsureAuthorizationMiddleware.php +++ b/src/Infrastructure/Rbac/src/Middleware/EnsureAuthorizationMiddleware.php @@ -1,11 +1,11 @@ get(ConfigService::class); - $apiKey = $configService->resolve("api.keys.template"); + $apiKey = $configService->resolve("api.keys.myTube"); return new RequestService( $apiKey, diff --git a/src/Infrastructure/Request/src/Middleware/AnalyzeHeaderMiddleware.php b/src/Infrastructure/Request/src/Middleware/AnalyzeHeaderMiddleware.php index 129efc5..5f5f1e2 100644 --- a/src/Infrastructure/Request/src/Middleware/AnalyzeHeaderMiddleware.php +++ b/src/Infrastructure/Request/src/Middleware/AnalyzeHeaderMiddleware.php @@ -1,11 +1,11 @@ userSessionRepository = $this->entityManager->getRepository(UserSession::class); diff --git a/src/Infrastructure/UuidGenerator/src/UuidGenerator.php b/src/Infrastructure/UuidGenerator/src/UuidGenerator.php index bde82b3..c4c6226 100644 --- a/src/Infrastructure/UuidGenerator/src/UuidGenerator.php +++ b/src/Infrastructure/UuidGenerator/src/UuidGenerator.php @@ -1,6 +1,6 @@