Created specs for API key roles

This commit is contained in:
Alejandro Celaya
2021-01-02 20:08:49 +01:00
parent 7e6882960e
commit df53e6c6f2
5 changed files with 93 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ use Happyr\DoctrineSpecification\Spec;
use Happyr\DoctrineSpecification\Specification\Specification;
use Ramsey\Uuid\Uuid;
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
use Shlinkio\Shlink\Rest\ApiKey\Role;
class ApiKey extends AbstractEntity
{
@@ -69,6 +70,7 @@ class ApiKey extends AbstractEntity
public function spec(): Specification
{
return Spec::andX();
$specs = $this->roles->map(fn (ApiKeyRole $role) => Role::toSpec($role));
return Spec::andX(...$specs);
}
}