Migrate existing endpoints to the new structure

[MAILPOET-4207]
This commit is contained in:
Jan Jakes
2022-04-12 13:17:53 +02:00
committed by Veljko V
parent f7888480b4
commit 6b1c6929d1
6 changed files with 66 additions and 20 deletions

View File

@@ -0,0 +1,26 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Endpoints\Workflows;
use MailPoet\Automation\Engine\API\Endpoint;
use MailPoet\Automation\Engine\API\Request;
use MailPoet\Automation\Engine\API\Response;
use MailPoet\Automation\Engine\Builder\CreateWorkflowController;
class WorkflowsPostEndpoint extends Endpoint {
/** @var CreateWorkflowController */
private $createController;
public function __construct(
CreateWorkflowController $createController
) {
$this->createController = $createController;
}
public function handle(Request $request): Response {
// TODO: validation
$data = $request->getBody();
$this->createController->createWorkflow($data);
return new Response();
}
}