refactor: use Providers

This commit is contained in:
Maël Gangloff
2025-12-02 20:51:15 +01:00
parent 0f06af937f
commit 9466b4985c
8 changed files with 65 additions and 74 deletions

View File

@@ -11,6 +11,7 @@ use App\Config\ConnectorProvider;
use App\Repository\ConnectorRepository;
use App\State\ConnectorCreateProcessor;
use App\State\ConnectorDeleteProcessor;
use App\State\MyConnectorsProvider;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -21,9 +22,8 @@ use Symfony\Component\Uid\Uuid;
shortName: 'Connector',
operations: [
new GetCollection(
routeName: 'connector_get_all_mine',
normalizationContext: ['groups' => 'connector:list'],
name: 'get_all_mine',
provider: MyConnectorsProvider::class
),
new Get(
normalizationContext: ['groups' => 'connector:list'],

View File

@@ -23,15 +23,6 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
#[ORM\Entity(repositoryClass: DomainRepository::class)]
#[ApiResource(
operations: [
/*
new GetCollection(
normalizationContext: [
'groups' => [
'domain:list'
]
]
),
*/
new GetCollection(
uriTemplate: '/domains',
normalizationContext: [

View File

@@ -12,7 +12,9 @@ use App\Controller\InstanceController;
uriTemplate: '/config',
controller: InstanceController::class,
shortName: 'Configuration',
description: 'Public configuration of the server',
read: false,
name: 'server-configuration',
),
]
)]

View File

@@ -10,6 +10,7 @@ use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Repository\WatchlistRepository;
use App\State\MyTrackedDomainProvider;
use App\State\MyWatchlistsProvider;
use App\State\WatchlistUpdateProcessor;
use Doctrine\Common\Collections\ArrayCollection;
@@ -33,12 +34,10 @@ use Symfony\Component\Validator\Constraints as Assert;
'event:list',
],
],
name: 'get_all_mine',
provider: MyWatchlistsProvider::class,
),
new GetCollection(
uriTemplate: '/tracked',
routeName: 'watchlist_get_tracked_domains',
normalizationContext: [
'groups' => [
'domain:list',
@@ -47,7 +46,7 @@ use Symfony\Component\Validator\Constraints as Assert;
'event:list',
],
],
name: 'get_tracked_domains'
provider: MyTrackedDomainProvider::class
),
new Get(
normalizationContext: [