mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
refactor: use Providers
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
]
|
||||
)]
|
||||
|
||||
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user