feat(central) : ajoute le pilotage de maintenance et le deploiement prod
This commit is contained in:
51
src/ApiResource/ManagedApplication.php
Normal file
51
src/ApiResource/ManagedApplication.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\State\ManagedApplicationProvider;
|
||||
use App\State\MaintenanceToggleProcessor;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new GetCollection(
|
||||
uriTemplate: '/applications',
|
||||
normalizationContext: ['groups' => ['app:read']],
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: ManagedApplicationProvider::class,
|
||||
),
|
||||
new Get(
|
||||
uriTemplate: '/applications/{slug}',
|
||||
normalizationContext: ['groups' => ['app:read']],
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: ManagedApplicationProvider::class,
|
||||
),
|
||||
new Post(
|
||||
uriTemplate: '/applications/{slug}/maintenance',
|
||||
normalizationContext: ['groups' => ['app:read']],
|
||||
denormalizationContext: ['groups' => ['app:write']],
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: ManagedApplicationProvider::class,
|
||||
processor: MaintenanceToggleProcessor::class,
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class ManagedApplication
|
||||
{
|
||||
#[ApiProperty(identifier: true)]
|
||||
#[Groups(['app:read'])]
|
||||
public string $slug = '';
|
||||
|
||||
#[Groups(['app:read'])]
|
||||
public string $name = '';
|
||||
|
||||
#[Groups(['app:read', 'app:write'])]
|
||||
public bool $maintenance = false;
|
||||
}
|
||||
Reference in New Issue
Block a user