feat : add DatabaseInfo API resource and provider

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-04-08 16:04:03 +02:00
parent 0019b5987d
commit df755d521c
2 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace App\ApiResource;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\State\DatabaseInfoProvider;
#[ApiResource(
operations: [
new Get(
uriTemplate: '/environments/{id}/database',
security: "is_granted('ROLE_ADMIN')",
provider: DatabaseInfoProvider::class,
),
],
)]
final class DatabaseInfo
{
public bool $connected = false;
public string $name = '';
public string $size = '';
public int $tableCount = 0;
public int $activeConnections = 0;
public float $cacheHitRatio = 0.0;
public string $largestTable = '';
}