Skip to content

Commit 8953940

Browse files
committed
Added API endpoints for server and site collections
1 parent 5b72353 commit 8953940

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- [#88](https://github.com/itk-dev/devops_itksites/pull/88)
1111
- Let users use the API
1212
- Add security to detection results API endpoint
13+
- Add server and site collections API endpoints
1314
- [#80](https://github.com/itk-dev/devops_itksites/pull/80) 5566: Service agreements
1415
- Add security contract entity with crud controller
1516
- Add Abstract full crud controller and extend on it in some cases

src/Entity/Server.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace App\Entity;
66

7+
use ApiPlatform\Metadata\ApiResource;
8+
use ApiPlatform\Metadata\GetCollection;
79
use App\Repository\ServerRepository;
810
use App\Trait\ApiKeyEntityTrait;
911
use Doctrine\Common\Collections\ArrayCollection;
@@ -14,6 +16,11 @@
1416
use Symfony\Component\Serializer\Attribute\SerializedName;
1517
use Symfony\Component\Validator\Constraints as Assert;
1618

19+
#[ApiResource(
20+
normalizationContext: ['groups' => ['export']],
21+
security: "is_granted('ROLE_USER')",
22+
)]
23+
#[GetCollection()]
1724
#[ORM\Entity(repositoryClass: ServerRepository::class)]
1825
class Server extends AbstractBaseEntity implements UserInterface, \Stringable
1926
{

src/Entity/Site.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace App\Entity;
66

7+
use ApiPlatform\Metadata\ApiResource;
8+
use ApiPlatform\Metadata\GetCollection;
79
use App\Repository\SiteRepository;
810
use App\Types\SiteType;
911
use Doctrine\Common\Collections\ArrayCollection;
@@ -13,6 +15,11 @@
1315
use Symfony\Component\Serializer\Attribute\SerializedName;
1416
use Symfony\Component\Validator\Constraints as Assert;
1517

18+
#[ApiResource(
19+
normalizationContext: ['groups' => ['export']],
20+
security: "is_granted('ROLE_USER')",
21+
)]
22+
#[GetCollection()]
1623
#[ORM\Entity(repositoryClass: SiteRepository::class)]
1724
#[ORM\UniqueConstraint(name: 'server_rootDir_configFilePath_idx', fields: ['server', 'rootDir', 'configFilePath'])]
1825
class Site extends AbstractHandlerResult implements \Stringable

0 commit comments

Comments
 (0)