diff --git a/.env.dist b/.env.dist index 69627d9..db3041d 100644 --- a/.env.dist +++ b/.env.dist @@ -6,7 +6,7 @@ MYSQL_PASSWORD=dev MYSQL_ROOT_PASSWORD=root MYSQL_DATABASE=db MYSQL_PUBLIC_PORT=3306 -PHP_VERSION=8.2 +PHP_VERSION=8.3 MARIADB_VERSION=latest APACHE_VERSION=2.4-alpine HTTP_PORT=80 diff --git a/config/routes.php b/config/routes.php index 5f85c0d..da5ceac 100644 --- a/config/routes.php +++ b/config/routes.php @@ -5,6 +5,7 @@ use Mezzio\Application; use Mezzio\MiddlewareFactory; use Psr\Container\ContainerInterface; +use Stormannsgal\App\Handler\Account\AccountCreateHandler; use Stormannsgal\App\Handler\Account\ListAllAccountsHandler; use Stormannsgal\App\Handler\PingHandler; use Stormannsgal\Core\Config\RouteName; @@ -41,6 +42,13 @@ */ return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void { - $app->get('/api/ping', PingHandler::class, RouteName::HANDLER_PING); + $app->get('/api/ping', PingHandler::class, RouteName::PING); + $app->post( + path: '/api/account', + middleware: [ + AccountCreateHandler::class, + ], + name: RouteName::ACCOUNT_CREATE + ); $app->get('/api/account/list/all', ListAllAccountsHandler::class, ListAllAccountsHandler::class); }; diff --git a/public/api/docs/swagger.json b/public/api/docs/swagger.json index 3b62ca7..0105a63 100644 --- a/public/api/docs/swagger.json +++ b/public/api/docs/swagger.json @@ -5,6 +5,24 @@ "version": "0.0.1" }, "paths": { + "/api/account": { + "post": { + "tags": [ + "Account" + ], + "summary": "Create new Account", + "description": "Create new Account", + "operationId": "902abdfc53a8327ba1a105a002a1e1f1", + "responses": { + "200": { + "description": "Success" + }, + "401": { + "description": "Unauthorized" + } + } + } + }, "/api/account/list/all": { "get": { "tags": [ diff --git a/src/App/Handler/Account/AccountCreateHandler.php b/src/App/Handler/Account/AccountCreateHandler.php new file mode 100644 index 0000000..85d4467 --- /dev/null +++ b/src/App/Handler/Account/AccountCreateHandler.php @@ -0,0 +1,26 @@ +