-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add api Controllers with mocked basic CRUD methods
- Loading branch information
awasiak
committed
Oct 30, 2018
1 parent
a3c1ad9
commit 9583740
Showing
11 changed files
with
311 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/SAREhub/Servitiom/Api/Controller/Service/ServiceInstancesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Controller\Service; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\Controller; | ||
use SAREhub\Microt\Util\JsonResponse; | ||
use Slim\Http\Request; | ||
use Slim\Http\Response; | ||
|
||
class ServiceInstancesController implements Controller | ||
{ | ||
public function createAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getOneAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getListAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function deleteAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/SAREhub/Servitiom/Api/Controller/Service/ServiceJobTemplatesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Controller\Service; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\Controller; | ||
use SAREhub\Microt\Util\JsonResponse; | ||
use Slim\Http\Request; | ||
use Slim\Http\Response; | ||
|
||
class ServiceJobTemplatesController implements Controller | ||
{ | ||
public function createAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getOneAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getListAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function deleteAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/SAREhub/Servitiom/Api/Controller/Service/ServiceVersionsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Controller\Service; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\Controller; | ||
use SAREhub\Microt\Util\JsonResponse; | ||
use Slim\Http\Request; | ||
use Slim\Http\Response; | ||
|
||
class ServiceVersionsController implements Controller | ||
{ | ||
public function createAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getOneAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getListAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function deleteAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/SAREhub/Servitiom/Api/Controller/Service/ServicesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Controller\Service; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\Controller; | ||
use SAREhub\Microt\Util\JsonResponse; | ||
use Slim\Http\Request; | ||
use Slim\Http\Response; | ||
|
||
class ServicesController implements Controller | ||
{ | ||
public function createAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getOneAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function getListAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
|
||
public function deleteAction(Request $request, Response $response): Response | ||
{ | ||
//@TODO implement | ||
return JsonResponse::wrap($response)->success("mock"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/SAREhub/Servitiom/Api/Routes/ServiceInstancesRoutesProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Routes; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\ControllerActionRoutes; | ||
use SAREhub\Microt\App\Controller\ControllerRoutesProvider; | ||
use SAREhub\Servitiom\Api\Api; | ||
use SAREhub\Servitiom\Api\Controller\Service\ServiceInstancesController; | ||
|
||
class ServiceInstancesRoutesProvider extends ControllerRoutesProvider | ||
{ | ||
const ATTR_SERVICE_INSTANCE_ID = "serviceInstanceId"; | ||
|
||
protected function getBaseUri(): string | ||
{ | ||
return Api::uriPattern( | ||
Api::VERSION_URI, | ||
"services", | ||
Api::uriAttribute(ServicesRoutesProvider::ATTR_SERVICE_ID), | ||
"instances" | ||
); | ||
} | ||
|
||
protected function getControllerClass(): string | ||
{ | ||
return ServiceInstancesController::class; | ||
} | ||
|
||
protected function injectRoutes(ControllerActionRoutes $routes) | ||
{ | ||
$routes->post("", "create"); | ||
$routes->get("", "getList"); | ||
$uriAttrServiceInstanceId = Api::uriAttribute(self::ATTR_SERVICE_INSTANCE_ID); | ||
$routes->get("/" . $uriAttrServiceInstanceId, "getOne"); | ||
$routes->delete("/" . $uriAttrServiceInstanceId, "delete"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/SAREhub/Servitiom/Api/Routes/ServicesRoutesProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Routes; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\ControllerActionRoutes; | ||
use SAREhub\Microt\App\Controller\ControllerRoutesProvider; | ||
use SAREhub\Servitiom\Api\Api; | ||
use SAREhub\Servitiom\Api\Controller\Service\ServicesController; | ||
|
||
class ServicesRoutesProvider extends ControllerRoutesProvider | ||
{ | ||
const ATTR_SERVICE_ID = "serviceId"; | ||
|
||
protected function getBaseUri(): string | ||
{ | ||
return Api::uriPattern(Api::VERSION_URI, "services"); | ||
} | ||
|
||
protected function getControllerClass(): string | ||
{ | ||
return ServicesController::class; | ||
} | ||
|
||
protected function injectRoutes(ControllerActionRoutes $routes) | ||
{ | ||
$routes->post("", "create"); | ||
$routes->get("", "getList"); | ||
$uriAttrServiceId = Api::uriAttribute(self::ATTR_SERVICE_ID); | ||
$routes->get("/" . $uriAttrServiceId, "getOne"); | ||
$routes->delete("/" . $uriAttrServiceId, "delete"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/SAREhub/Servitiom/Api/Routes/TenantsRoutesProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
namespace SAREhub\Servitiom\Api\Routes; | ||
|
||
|
||
use SAREhub\Microt\App\Controller\ControllerActionRoutes; | ||
use SAREhub\Microt\App\Controller\ControllerRoutesProvider; | ||
use SAREhub\Servitiom\Api\Api; | ||
use SAREhub\Servitiom\Api\Controller\Tenant\TenantsController; | ||
|
||
class TenantsRoutesProvider extends ControllerRoutesProvider | ||
{ | ||
const ATTR_TENANT_ID = "tenantId"; | ||
|
||
protected function getBaseUri(): string | ||
{ | ||
return Api::uriPattern(Api::VERSION_URI, "tenants"); | ||
} | ||
|
||
protected function getControllerClass(): string | ||
{ | ||
return TenantsController::class; | ||
} | ||
|
||
protected function injectRoutes(ControllerActionRoutes $routes) | ||
{ | ||
$routes->post("", "create"); | ||
$routes->get("", "getList"); | ||
$uriAttrTenantId = Api::uriAttribute(self::ATTR_TENANT_ID); | ||
$routes->get("/" . $uriAttrTenantId, "getOne"); | ||
$routes->delete("/" . $uriAttrTenantId, "delete"); | ||
} | ||
} |