Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions resources/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
use Fusio\Impl\Service\Action\Producer;
use Fusio\Impl\Service\Agent;
use Fusio\Impl\Service\Event\Dispatcher;
use Fusio\Impl\Service\Mcp\ReferenceHandler;
use Fusio\Impl\Service\Tenant\LimiterInterface;
use Fusio\Impl\Service\User\Captcha;
use Fusio\Impl\Tenant\UnlimitedLimiter;
use Mcp\Capability\Registry\ReferenceHandlerInterface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\SimpleCache\CacheInterface;
use PSX\Api;
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Action/Action/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\Filter\TaxonomyQueryFilter;
use Fusio\Impl\Backend\View;

/**
Expand All @@ -46,7 +46,7 @@ public function __construct(View\Action $view)
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
TaxonomyQueryFilter::from($request),
$context
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Backend/Action/Cronjob/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\Filter\TaxonomyQueryFilter;
use Fusio\Impl\Backend\View;

/**
Expand All @@ -46,7 +47,7 @@ public function __construct(View\Cronjob $view)
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
TaxonomyQueryFilter::from($request),
$context
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Backend/Action/Event/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\Filter\TaxonomyQueryFilter;
use Fusio\Impl\Backend\View;

/**
Expand All @@ -46,7 +47,7 @@ public function __construct(View\Event $view)
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
TaxonomyQueryFilter::from($request),
$context
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Action/Operation/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\Filter\TaxonomyQueryFilter;
use Fusio\Impl\Backend\View;

/**
Expand All @@ -46,7 +46,7 @@ public function __construct(View\Operation $view)
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
TaxonomyQueryFilter::from($request),
$context
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Action/Schema/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\Filter\TaxonomyQueryFilter;
use Fusio\Impl\Backend\View;

/**
Expand All @@ -46,7 +46,7 @@ public function __construct(View\Schema $view)
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
TaxonomyQueryFilter::from($request),
$context
);
}
Expand Down
62 changes: 62 additions & 0 deletions src/Backend/Action/Taxonomy/Create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/*
* Fusio - Self-Hosted API Management for Builders.
* For the current version and information visit <https://www.fusio-project.org/>
*
* Copyright (c) Christoph Kappestein <christoph.kappestein@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Fusio\Impl\Backend\Action\Taxonomy;

use Fusio\Engine\ActionInterface;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Service\System\ContextFactory;
use Fusio\Impl\Service\Taxonomy;
use Fusio\Model\Backend\TaxonomyCreate;
use PSX\Http\Environment\HttpResponse;

/**
* Create
*
* @author Christoph Kappestein <christoph.kappestein@gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.fusio-project.org
*/
readonly class Create implements ActionInterface
{
public function __construct(private Taxonomy $taxonomyService, private ContextFactory $contextFactory)
{
}

public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
$body = $request->getPayload();

assert($body instanceof TaxonomyCreate);

$id = $this->taxonomyService->create(
$body,
$this->contextFactory->newActionContext($context)
);

return new HttpResponse(201, [], [
'success' => true,
'message' => 'Taxonomy successfully created',
'id' => '' . $id,
]);
}
}
56 changes: 56 additions & 0 deletions src/Backend/Action/Taxonomy/Delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/*
* Fusio - Self-Hosted API Management for Builders.
* For the current version and information visit <https://www.fusio-project.org/>
*
* Copyright (c) Christoph Kappestein <christoph.kappestein@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Fusio\Impl\Backend\Action\Taxonomy;

use Fusio\Engine\ActionInterface;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Service\System\ContextFactory;
use Fusio\Impl\Service\Taxonomy;

/**
* Delete
*
* @author Christoph Kappestein <christoph.kappestein@gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.fusio-project.org
*/
readonly class Delete implements ActionInterface
{
public function __construct(private Taxonomy $taxonomyService, private ContextFactory $contextFactory)
{
}

public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
$id = $this->taxonomyService->delete(
$request->get('taxonomy_id'),
$this->contextFactory->newActionContext($context)
);

return [
'success' => true,
'message' => 'Taxonomy successfully deleted',
'id' => '' . $id,
];
}
}
61 changes: 61 additions & 0 deletions src/Backend/Action/Taxonomy/Get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/*
* Fusio - Self-Hosted API Management for Builders.
* For the current version and information visit <https://www.fusio-project.org/>
*
* Copyright (c) Christoph Kappestein <christoph.kappestein@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Fusio\Impl\Backend\Action\Taxonomy;

use Fusio\Engine\ActionInterface;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\View;
use Fusio\Impl\Table;
use PSX\Http\Exception as StatusCode;

/**
* Get
*
* @author Christoph Kappestein <christoph.kappestein@gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.fusio-project.org
*/
readonly class Get implements ActionInterface
{
public function __construct(private View\Taxonomy $view)
{
}

public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
$taxonomy = $this->view->getEntity(
$request->get('taxonomy_id'),
$context
);

if (empty($taxonomy)) {
throw new StatusCode\NotFoundException('Could not find taxonomy');
}

if ($taxonomy['status'] == Table\Category::STATUS_DELETED) {
throw new StatusCode\GoneException('Taxonomy was deleted');
}

return $taxonomy;
}
}
50 changes: 50 additions & 0 deletions src/Backend/Action/Taxonomy/GetAll.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/*
* Fusio - Self-Hosted API Management for Builders.
* For the current version and information visit <https://www.fusio-project.org/>
*
* Copyright (c) Christoph Kappestein <christoph.kappestein@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Fusio\Impl\Backend\Action\Taxonomy;

use Fusio\Engine\ActionInterface;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Backend\Filter\QueryFilter;
use Fusio\Impl\Backend\View;

/**
* GetAll
*
* @author Christoph Kappestein <christoph.kappestein@gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.fusio-project.org
*/
readonly class GetAll implements ActionInterface
{
public function __construct(private View\Taxonomy $view)
{
}

public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
return $this->view->getCollection(
QueryFilter::from($request),
$context
);
}
}
61 changes: 61 additions & 0 deletions src/Backend/Action/Taxonomy/Move.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/*
* Fusio - Self-Hosted API Management for Builders.
* For the current version and information visit <https://www.fusio-project.org/>
*
* Copyright (c) Christoph Kappestein <christoph.kappestein@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Fusio\Impl\Backend\Action\Taxonomy;

use Fusio\Engine\ActionInterface;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Service\System\ContextFactory;
use Fusio\Impl\Service\Taxonomy;
use Fusio\Model\Backend\TaxonomyMove;

/**
* Move
*
* @author Christoph Kappestein <christoph.kappestein@gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0
* @link https://www.fusio-project.org
*/
readonly class Move implements ActionInterface
{
public function __construct(private Taxonomy $taxonomyService, private ContextFactory $contextFactory)
{
}

public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): mixed
{
$body = $request->getPayload();

assert($body instanceof TaxonomyMove);

$this->taxonomyService->move(
$request->get('taxonomy_id'),
$body,
$this->contextFactory->newActionContext($context)
);

return [
'success' => true,
'message' => 'Moved objects to taxonomy successfully',
];
}
}
Loading