diff --git a/bin/createApi.php b/bin/createApi.php index 4f411c8..6c675c7 100644 --- a/bin/createApi.php +++ b/bin/createApi.php @@ -110,7 +110,7 @@ return [ {$apiHandlerName}::class => AutoWiringFactory::class, // Response Formatter - {$$apiResponseFormatterName}::class => AutoWiringFactory::class, + {$apiResponseFormatterName}::class => AutoWiringFactory::class, ], ]; "; diff --git a/src/ApiDomain/External/TagList/config/routes.php b/src/ApiDomain/External/TagList/config/routes.php new file mode 100644 index 0000000..b1db99f --- /dev/null +++ b/src/ApiDomain/External/TagList/config/routes.php @@ -0,0 +1,16 @@ + 'TODO.TODO', + 'path' => '/api/TODO/TODO[/]', + 'allowed_methods' => ['POST'], + 'middleware' => [ + ReadListHandler::class, + ], + ], +]; diff --git a/src/ApiDomain/External/TagList/config/service_manager.php b/src/ApiDomain/External/TagList/config/service_manager.php new file mode 100644 index 0000000..ca1ecbc --- /dev/null +++ b/src/ApiDomain/External/TagList/config/service_manager.php @@ -0,0 +1,17 @@ + [ + // Handler + ReadListHandler::class => AutoWiringFactory::class, + + // Response Formatter + ::class => AutoWiringFactory::class, + ], +]; diff --git a/src/ApiDomain/External/TagList/src/ConfigProvider.php b/src/ApiDomain/External/TagList/src/ConfigProvider.php new file mode 100644 index 0000000..9bd9982 --- /dev/null +++ b/src/ApiDomain/External/TagList/src/ConfigProvider.php @@ -0,0 +1,16 @@ + require __DIR__ . './../config/service_manager.php', + 'routes' => require __DIR__ . '/./../config/routes.php', + ]; + } +} diff --git a/src/ApiDomain/External/TagList/src/Handler/ReadListHandler.php b/src/ApiDomain/External/TagList/src/Handler/ReadListHandler.php new file mode 100644 index 0000000..8cc9195 --- /dev/null +++ b/src/ApiDomain/External/TagList/src/Handler/ReadListHandler.php @@ -0,0 +1,38 @@ +getBody()->getContents(), + true + ); + + $readListQuery = $this->readListQueryBuilder->build( + $data + ); + $result = $this->readListQueryHandler->execute($readListQuery); + + return new SuccessResponse($this->responseFormatter->format($result)); + } +} diff --git a/src/ApiDomain/External/TagList/src/ResponseFormatter/ReadListResponseFormatter.php b/src/ApiDomain/External/TagList/src/ResponseFormatter/ReadListResponseFormatter.php new file mode 100644 index 0000000..23d5563 --- /dev/null +++ b/src/ApiDomain/External/TagList/src/ResponseFormatter/ReadListResponseFormatter.php @@ -0,0 +1,15 @@ + [ + /// CQRS + // ReadList + ReadListQueryBuilder::class => AutoWiringFactory::class, + ReadListQueryHandler::class => AutoWiringFactory::class, + ], +]; diff --git a/src/HandlingDomain/TagList/src/ConfigProvider.php b/src/HandlingDomain/TagList/src/ConfigProvider.php new file mode 100644 index 0000000..4fa6c85 --- /dev/null +++ b/src/HandlingDomain/TagList/src/ConfigProvider.php @@ -0,0 +1,15 @@ + require __DIR__ . './../config/service_manager.php', + ]; + } +} diff --git a/src/HandlingDomain/TagList/src/Handler/Query/ReadList/ReadListQuery.php b/src/HandlingDomain/TagList/src/Handler/Query/ReadList/ReadListQuery.php new file mode 100644 index 0000000..b35468b --- /dev/null +++ b/src/HandlingDomain/TagList/src/Handler/Query/ReadList/ReadListQuery.php @@ -0,0 +1,13 @@ +