mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
chore: merge master
This commit is contained in:
@@ -9,6 +9,8 @@ use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Config\ConnectorProvider;
|
||||
use App\Repository\ConnectorRepository;
|
||||
use App\State\ConnectorCreateProcessor;
|
||||
use App\State\ConnectorDeleteProcessor;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -28,15 +30,15 @@ use Symfony\Component\Uid\Uuid;
|
||||
security: 'object.user == user'
|
||||
),
|
||||
new Post(
|
||||
routeName: 'connector_create',
|
||||
normalizationContext: ['groups' => ['connector:create', 'connector:list']],
|
||||
denormalizationContext: ['groups' => 'connector:create'],
|
||||
name: 'create'
|
||||
name: 'create',
|
||||
processor: ConnectorCreateProcessor::class
|
||||
),
|
||||
new Delete(
|
||||
routeName: 'connector_delete',
|
||||
security: 'object.user == user',
|
||||
name: 'delete'
|
||||
name: 'delete',
|
||||
processor: ConnectorDeleteProcessor::class
|
||||
),
|
||||
]
|
||||
)]
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Config\EventAction;
|
||||
use App\Controller\DomainRefreshController;
|
||||
use App\Repository\DomainRepository;
|
||||
use App\Service\RDAPService;
|
||||
use App\State\AutoRegisterDomainProvider;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
@@ -54,7 +55,8 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
],
|
||||
read: false
|
||||
),
|
||||
]
|
||||
],
|
||||
provider: AutoRegisterDomainProvider::class
|
||||
)]
|
||||
class Domain
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\Metadata\Put;
|
||||
use App\Repository\WatchListRepository;
|
||||
use App\State\WatchListUpdateProcessor;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
@@ -23,35 +24,40 @@ use Symfony\Component\Uid\Uuid;
|
||||
operations: [
|
||||
new GetCollection(
|
||||
routeName: 'watchlist_get_all_mine',
|
||||
normalizationContext: ['groups' => [
|
||||
'watchlist:list',
|
||||
'domain:list',
|
||||
'event:list',
|
||||
]],
|
||||
normalizationContext: [
|
||||
'groups' => [
|
||||
'watchlist:list',
|
||||
'domain:list',
|
||||
'event:list',
|
||||
],
|
||||
],
|
||||
name: 'get_all_mine',
|
||||
),
|
||||
new GetCollection(
|
||||
uriTemplate: '/tracked',
|
||||
routeName: 'watchlist_get_tracked_domains',
|
||||
normalizationContext: ['groups' => [
|
||||
'domain:list',
|
||||
'tld:list',
|
||||
'event:list',
|
||||
'domain:list',
|
||||
'event:list',
|
||||
]],
|
||||
normalizationContext: [
|
||||
'groups' => [
|
||||
'domain:list',
|
||||
'tld:list',
|
||||
'event:list',
|
||||
'domain:list',
|
||||
'event:list',
|
||||
],
|
||||
],
|
||||
name: 'get_tracked_domains'
|
||||
),
|
||||
new Get(
|
||||
normalizationContext: ['groups' => [
|
||||
'watchlist:item',
|
||||
'domain:item',
|
||||
'event:list',
|
||||
'domain-entity:entity',
|
||||
'nameserver-entity:nameserver',
|
||||
'nameserver-entity:entity',
|
||||
'tld:item',
|
||||
],
|
||||
normalizationContext: [
|
||||
'groups' => [
|
||||
'watchlist:item',
|
||||
'domain:item',
|
||||
'event:list',
|
||||
'domain-entity:entity',
|
||||
'nameserver-entity:nameserver',
|
||||
'nameserver-entity:entity',
|
||||
'tld:item',
|
||||
],
|
||||
],
|
||||
security: 'object.user == user'
|
||||
),
|
||||
@@ -78,16 +84,17 @@ use Symfony\Component\Uid\Uuid;
|
||||
name: 'calendar'
|
||||
),
|
||||
new Post(
|
||||
routeName: 'watchlist_create', normalizationContext: ['groups' => 'watchlist:list'],
|
||||
normalizationContext: ['groups' => 'watchlist:list'],
|
||||
denormalizationContext: ['groups' => 'watchlist:create'],
|
||||
name: 'create'
|
||||
name: 'create',
|
||||
processor: WatchListUpdateProcessor::class,
|
||||
),
|
||||
new Put(
|
||||
routeName: 'watchlist_update',
|
||||
normalizationContext: ['groups' => 'watchlist:item'],
|
||||
denormalizationContext: ['groups' => ['watchlist:create', 'watchlist:token']],
|
||||
security: 'object.user == user',
|
||||
name: 'update'
|
||||
name: 'update',
|
||||
processor: WatchListUpdateProcessor::class,
|
||||
),
|
||||
new Delete(
|
||||
security: 'object.user == user'
|
||||
@@ -145,10 +152,12 @@ class WatchList
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchLists')]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
|
||||
public ?User $user = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'uuid')]
|
||||
#[Groups(['watchlist:item', 'watchlist:list', 'watchlist:token'])]
|
||||
private string $token;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Domain>
|
||||
*/
|
||||
@@ -156,7 +165,7 @@ class WatchList
|
||||
#[ORM\JoinTable(name: 'watch_lists_domains',
|
||||
joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token', onDelete: 'CASCADE')],
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name', onDelete: 'CASCADE')])]
|
||||
#[Groups(['watchlist:list', 'watchlist:item'])]
|
||||
#[Groups(['watchlist:create', 'watchlist:list', 'watchlist:item'])]
|
||||
private Collection $domains;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,28 +2,58 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Config\TriggerAction;
|
||||
use App\Repository\EventTriggerRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ORM\Entity(repositoryClass: EventTriggerRepository::class)]
|
||||
#[ApiResource(
|
||||
uriTemplate: '/watchlists/{watchListId}/triggers/{action}/{event}',
|
||||
operations: [
|
||||
new Get(),
|
||||
new GetCollection(
|
||||
uriTemplate: '/watchlists/{watchListId}/triggers',
|
||||
uriVariables: [
|
||||
'watchListId' => new Link(fromProperty: 'token', toProperty: 'watchList', fromClass: WatchList::class),
|
||||
],
|
||||
),
|
||||
new Post(
|
||||
uriTemplate: '/watchlist-triggers',
|
||||
uriVariables: [],
|
||||
security: 'true'
|
||||
),
|
||||
new Delete(),
|
||||
],
|
||||
uriVariables: [
|
||||
'watchListId' => new Link(fromProperty: 'token', toProperty: 'watchList', fromClass: WatchList::class),
|
||||
'action' => 'action',
|
||||
'event' => 'event',
|
||||
],
|
||||
security: 'object.getWatchList().user == user',
|
||||
)]
|
||||
class WatchListTrigger
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: false)]
|
||||
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create'])]
|
||||
private ?string $event = null;
|
||||
private ?string $event;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: WatchList::class, cascade: ['persist'], inversedBy: 'watchListTriggers')]
|
||||
#[ORM\ManyToOne(targetEntity: WatchList::class, inversedBy: 'watchListTriggers')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'token', nullable: false, onDelete: 'CASCADE')]
|
||||
private ?WatchList $watchList = null;
|
||||
private ?WatchList $watchList;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(enumType: TriggerAction::class)]
|
||||
#[ORM\Column(nullable: false, enumType: TriggerAction::class)]
|
||||
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create'])]
|
||||
private ?TriggerAction $action = null;
|
||||
private ?TriggerAction $action;
|
||||
|
||||
public function getEvent(): ?string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user