|
@@ -6,7 +6,7 @@ namespace Opentalent\OtAdmin\Http;
|
|
|
use Opentalent\OtAdmin\Controller\SiteController;
|
|
use Opentalent\OtAdmin\Controller\SiteController;
|
|
|
use Psr\Log\LoggerAwareInterface;
|
|
use Psr\Log\LoggerAwareInterface;
|
|
|
use Psr\Log\LoggerAwareTrait;
|
|
use Psr\Log\LoggerAwareTrait;
|
|
|
-use TYPO3\CMS\Core\Http\HtmlResponse;
|
|
|
|
|
|
|
+use TYPO3\CMS\Core\Http\JsonResponse;
|
|
|
use TYPO3\CMS\Core\Http\ServerRequest;
|
|
use TYPO3\CMS\Core\Http\ServerRequest;
|
|
|
|
|
|
|
|
class ApiController implements LoggerAwareInterface
|
|
class ApiController implements LoggerAwareInterface
|
|
@@ -60,7 +60,7 @@ class ApiController implements LoggerAwareInterface
|
|
|
* Create the organization's website
|
|
* Create the organization's website
|
|
|
*
|
|
*
|
|
|
* @param ServerRequest $request
|
|
* @param ServerRequest $request
|
|
|
- * @return HtmlResponse
|
|
|
|
|
|
|
+ * @return JsonResponse
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
public function createSiteAction(ServerRequest $request) {
|
|
public function createSiteAction(ServerRequest $request) {
|
|
@@ -75,7 +75,13 @@ class ApiController implements LoggerAwareInterface
|
|
|
"OtAdmin API: A new website has been created with root page uid=" . $rootUid .
|
|
"OtAdmin API: A new website has been created with root page uid=" . $rootUid .
|
|
|
" for the organization " . $organizationId));
|
|
" for the organization " . $organizationId));
|
|
|
|
|
|
|
|
- return new HtmlResponse("A new website has been created with root page uid=" . $rootUid);
|
|
|
|
|
|
|
+ return new JsonResponse(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'organization_id' => $organizationId,
|
|
|
|
|
+ 'msg' => "A new website has been created with root page uid=" . $rootUid,
|
|
|
|
|
+ 'root_uid' => $rootUid
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -85,7 +91,7 @@ class ApiController implements LoggerAwareInterface
|
|
|
* Update the settings of the organization's website
|
|
* Update the settings of the organization's website
|
|
|
*
|
|
*
|
|
|
* @param ServerRequest $request
|
|
* @param ServerRequest $request
|
|
|
- * @return HtmlResponse
|
|
|
|
|
|
|
+ * @return JsonResponse
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
public function updateSiteConstantsAction(ServerRequest $request) {
|
|
public function updateSiteConstantsAction(ServerRequest $request) {
|
|
@@ -100,7 +106,13 @@ class ApiController implements LoggerAwareInterface
|
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been updated " .
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been updated " .
|
|
|
" (organization: " . $organizationId . ")"));
|
|
" (organization: " . $organizationId . ")"));
|
|
|
|
|
|
|
|
- return new HtmlResponse("The website with root uid " . $rootUid . " has been updated");
|
|
|
|
|
|
|
+ return new JsonResponse(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'organization_id' => $organizationId,
|
|
|
|
|
+ 'msg' => "The website with root uid " . $rootUid . " has been updated",
|
|
|
|
|
+ 'root_uid' => $rootUid
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -110,7 +122,7 @@ class ApiController implements LoggerAwareInterface
|
|
|
* Proceeds to a soft-deletion of the organization's website
|
|
* Proceeds to a soft-deletion of the organization's website
|
|
|
*
|
|
*
|
|
|
* @param ServerRequest $request
|
|
* @param ServerRequest $request
|
|
|
- * @return HtmlResponse
|
|
|
|
|
|
|
+ * @return JsonResponse
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
public function deleteSiteAction(ServerRequest $request) {
|
|
public function deleteSiteAction(ServerRequest $request) {
|
|
@@ -125,7 +137,13 @@ class ApiController implements LoggerAwareInterface
|
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been soft-deleted " .
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been soft-deleted " .
|
|
|
" (organization: " . $organizationId . ")"));
|
|
" (organization: " . $organizationId . ")"));
|
|
|
|
|
|
|
|
- return new HtmlResponse("The website with root uid " . $rootUid . " has been soft-deleted. Use the /site/undelete route to restore it.");
|
|
|
|
|
|
|
+ return new JsonResponse(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'organization_id' => $organizationId,
|
|
|
|
|
+ 'msg' => "The website with root uid " . $rootUid . " has been soft-deleted. Use the /site/undelete route to restore it.",
|
|
|
|
|
+ 'root_uid' => $rootUid
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -135,7 +153,7 @@ class ApiController implements LoggerAwareInterface
|
|
|
* Restore a soft-deleted organization's website
|
|
* Restore a soft-deleted organization's website
|
|
|
*
|
|
*
|
|
|
* @param ServerRequest $request
|
|
* @param ServerRequest $request
|
|
|
- * @return HtmlResponse
|
|
|
|
|
|
|
+ * @return JsonResponse
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
public function undeleteSiteAction(ServerRequest $request) {
|
|
public function undeleteSiteAction(ServerRequest $request) {
|
|
@@ -150,6 +168,12 @@ class ApiController implements LoggerAwareInterface
|
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been restored " .
|
|
"OtAdmin API: The website with root uid " . $rootUid . " has been restored " .
|
|
|
" (organization: " . $organizationId . ")"));
|
|
" (organization: " . $organizationId . ")"));
|
|
|
|
|
|
|
|
- return new HtmlResponse("The website with root uid " . $rootUid . " has been restored");
|
|
|
|
|
|
|
+ return new JsonResponse(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'organization_id' => $organizationId,
|
|
|
|
|
+ 'msg' => "The website with root uid " . $rootUid . " has been restored",
|
|
|
|
|
+ 'root_uid' => $rootUid
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|