Skip to content

Commit

Permalink
use trash restore body
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Jul 9, 2022
1 parent 4af793b commit 8bc3147
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Backend/Action/Trash/Restore.php
Expand Up @@ -26,6 +26,8 @@
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use Fusio\Impl\Service\System\Restorer;
use Fusio\Model\Backend\Plan_Create;
use Fusio\Model\Backend\Trash_Restore;

/**
* Restore
Expand All @@ -45,9 +47,13 @@ public function __construct(Restorer $restorer)

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

assert($body instanceof Trash_Restore);

$this->restorer->restore(
$request->get('type'),
$request->get('id')
$body->getId()
);

return [
Expand Down
4 changes: 2 additions & 2 deletions tests/Backend/Api/Trash/EntityTest.php
Expand Up @@ -109,11 +109,11 @@ public function testGetNotFound()

public function testPost()
{
$response = $this->sendRequest('/backend/trash/app?id=4', 'POST', array(
$response = $this->sendRequest('/backend/trash/app', 'POST', array(
'User-Agent' => 'Fusio TestCase',
'Authorization' => 'Bearer da250526d583edabca8ac2f99e37ee39aa02a3c076c0edc6929095e20ca18dcf'
), json_encode([
'foo' => 'bar',
'id' => 4,
]));

$body = (string) $response->getBody();
Expand Down

0 comments on commit 8bc3147

Please sign in to comment.