Skip to content

Commit

Permalink
Added option to easily select different modules
Browse files Browse the repository at this point in the history
  • Loading branch information
peldax authored Mar 16, 2024
1 parent 328c03e commit 3d31e9b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ApiPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use \Nette\Application\Responses\TextResponse;

final class ApiPresenter implements \Nette\Application\IPresenter
class ApiPresenter implements \Nette\Application\IPresenter
{
private \Graphpinator\Graphpinator $graphpinator;

Expand All @@ -23,10 +23,7 @@ public function __construct(
$debugMode
? \Graphpinator\ErrorHandlingMode::OUTPUTABLE
: \Graphpinator\ErrorHandlingMode::ALL,
new \Graphpinator\Module\ModuleSet([
//new \Graphpinator\QueryCost\MaxDepthModule(15),
new \Graphpinator\PersistedQueries\PersistedQueriesModule($schema, $this->cache),
]),
$this->getEnabledModules(),
new \Graphpinator\Nette\TracyLogger(),
);
}
Expand All @@ -40,6 +37,14 @@ public function run(\Nette\Application\Request $request) : \Nette\Application\Re
};
}

protected function getEnabledModules() : \Graphpinator\Module\ModuleSet
{
return new \Graphpinator\Module\ModuleSet([
//new \Graphpinator\QueryCost\MaxDepthModule(15),
new \Graphpinator\PersistedQueries\PersistedQueriesModule($schema, $this->cache),

Check failure on line 44 in src/ApiPresenter.php

View workflow job for this annotation

GitHub Actions / phpstan

Undefined variable: $schema
]);
}

private function createPreflightResponse() : TextResponse
{
$this->response->setHeader('Access-Control-Allow-Credentials', 'true');
Expand Down

0 comments on commit 3d31e9b

Please sign in to comment.