mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Fixed API tests
This commit is contained in:
@@ -6,7 +6,6 @@ namespace Shlinkio\Shlink\Core\Repository;
|
||||
|
||||
use Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository;
|
||||
use Happyr\DoctrineSpecification\Spec;
|
||||
use Happyr\DoctrineSpecification\Specification\Specification;
|
||||
use Shlinkio\Shlink\Core\Entity\Tag;
|
||||
use Shlinkio\Shlink\Core\Tag\Model\TagInfo;
|
||||
use Shlinkio\Shlink\Core\Tag\Spec\CountTagsWithName;
|
||||
@@ -33,7 +32,7 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
|
||||
/**
|
||||
* @return TagInfo[]
|
||||
*/
|
||||
public function findTagsWithInfo(?Specification $spec = null): array
|
||||
public function findTagsWithInfo(?ApiKey $apiKey = null): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('t');
|
||||
$qb->select('t AS tag', 'COUNT(DISTINCT s.id) AS shortUrlsCount', 'COUNT(DISTINCT v.id) AS visitsCount')
|
||||
@@ -42,7 +41,9 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
|
||||
->groupBy('t')
|
||||
->orderBy('t.name', 'ASC');
|
||||
|
||||
$this->applySpecification($qb, $spec, 't');
|
||||
if ($apiKey !== null) {
|
||||
$this->applySpecification($qb, $apiKey->spec(false, 'shortUrls'), 't');
|
||||
}
|
||||
|
||||
$query = $qb->getQuery();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ interface TagRepositoryInterface extends ObjectRepository, EntitySpecificationRe
|
||||
/**
|
||||
* @return TagInfo[]
|
||||
*/
|
||||
public function findTagsWithInfo(?Specification $spec = null): array;
|
||||
public function findTagsWithInfo(?ApiKey $apiKey = null): array;
|
||||
|
||||
public function tagExists(string $tag, ?ApiKey $apiKey = null): bool;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user