Added happyr/doctrine-specification to support dunamically applying specs to queries

This commit is contained in:
Alejandro Celaya
2021-01-02 17:14:42 +01:00
parent 90551ff3bc
commit ecf22ae4b6
11 changed files with 48 additions and 28 deletions

View File

@@ -10,6 +10,7 @@ use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Core\Tag\Model\TagInfo;
use Shlinkio\Shlink\Core\Tag\TagServiceInterface;
use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
use function Functional\map;
@@ -38,7 +39,8 @@ class ListTagsAction extends AbstractRestAction
]);
}
$tagsInfo = $this->tagService->tagsInfo();
$apiKey = AuthenticationMiddleware::apiKeyFromRequest($request);
$tagsInfo = $this->tagService->tagsInfo($apiKey);
$data = map($tagsInfo, fn (TagInfo $info) => (string) $info->tag());
return new JsonResponse([

View File

@@ -5,6 +5,8 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Rest\Entity;
use Cake\Chronos\Chronos;
use Happyr\DoctrineSpecification\Spec;
use Happyr\DoctrineSpecification\Specification\Specification;
use Ramsey\Uuid\Uuid;
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
@@ -59,4 +61,11 @@ class ApiKey extends AbstractEntity
{
return $this->key;
}
/**
*/
public function spec(): Specification
{
return Spec::andX();
}
}