bug fixes and subscription improvements

This commit is contained in:
Dennis Eichhorn 2023-04-25 01:51:28 +00:00
parent 94f57e6121
commit 5c4b7d05db
2 changed files with 37 additions and 6 deletions

View File

@ -505,6 +505,20 @@ final class ApiController extends Controller
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template);
}
/**
* Install a new workflow template.
*
* Some actions have a install function, which must be called when first installing/registering a new action in a template.
* An example could be the cron job for a timed trigger, which must be installed when the template is installed.
*
* @param WorkflowTemplate $template Workflow template
* @param array $actions Actions
*
* @return void
*
* @since 1.0.0
* @todo: also implement the delete and update functions
*/
private function installWorkflowModel(WorkflowTemplate $template, array $actions) : void
{
$schema = $template->schema;
@ -519,6 +533,15 @@ final class ApiController extends Controller
}
}
/**
* Installs a timed trigger for a workflow template.
*
* @param WorkflowTemplate $template Workflow template
*
* @return void
*
* @since 1.0.0
*/
public function installTimedTrigger(WorkflowTemplate $template) : void
{
$id = 'Workflow-' . $template->getId();

View File

@ -178,7 +178,15 @@ final class CliController extends Controller
$instance = new WorkflowInstance();
$actions = \json_decode(\file_get_contents(__DIR__ . '/../Definitions/actions.json'), true);
$actionString = \file_get_contents(__DIR__ . '/../Definitions/actions.json');
if ($actionString === false) {
return $instance;
}
$actions = \json_decode($actionString, true);
if (!\is_array($actions)) {
return $instance;
}
foreach ($template->schema as $e) {
if ($e['id'] === $request->getDataString('trigger')) {