Created new middlewares to track not found visits

This commit is contained in:
Alejandro Celaya
2021-02-08 21:38:19 +01:00
parent 36be44e7b5
commit 15061d3e0d
10 changed files with 187 additions and 40 deletions

View File

@@ -211,8 +211,9 @@ class VisitRepository extends EntitySpecificationRepository implements VisitRepo
public function countVisits(?ApiKey $apiKey = null): int
{
return (int) $this->matchSingleScalarResult(
Spec::countOf(new WithApiKeySpecsEnsuringJoin($apiKey, 'shortUrl')),
);
return (int) $this->matchSingleScalarResult(Spec::countOf(Spec::andX(
Spec::isNotNull('shortUrl'),
new WithApiKeySpecsEnsuringJoin($apiKey, 'shortUrl'),
)));
}
}