chore: rename WatchList to Watchlist

This commit is contained in:
Maël Gangloff
2025-10-25 17:26:56 +02:00
parent ff90477695
commit 5243b3c2dd
32 changed files with 278 additions and 199 deletions

View File

@@ -63,7 +63,7 @@ export function UpdateWatchlistButton({watchlist, onUpdateWatchlist, connectors}
}} }}
connectors={connectors} connectors={connectors}
isCreation={false} isCreation={false}
watchList={watchlist} watchlist={watchlist}
/> />
</Drawer> </Drawer>
</> </>

View File

@@ -33,7 +33,7 @@ export function WatchlistForm({form, connectors, onFinish, isCreation}: {
connectors: Array<Connector & { id: string }> connectors: Array<Connector & { id: string }>
onFinish: (values: { domains: string[], trackedEvents: string[], trackedEppStatus: string[], token: string }) => void onFinish: (values: { domains: string[], trackedEvents: string[], trackedEppStatus: string[], token: string }) => void
isCreation: boolean, isCreation: boolean,
watchList?: Watchlist, watchlist?: Watchlist,
}) { }) {
const rdapEventNameTranslated = rdapEventNameTranslation() const rdapEventNameTranslated = rdapEventNameTranslation()
const rdapEventDetailTranslated = rdapEventDetailTranslation() const rdapEventDetailTranslated = rdapEventDetailTranslation()

View File

@@ -23,7 +23,7 @@ framework:
Symfony\Component\Notifier\Message\SmsMessage: async Symfony\Component\Notifier\Message\SmsMessage: async
App\Message\OrderDomain: async App\Message\OrderDomain: async
App\Message\ProcessWatchListsTrigger: async App\Message\ProcessWatchlistTrigger: async
App\Message\SendDomainEventNotif: async App\Message\SendDomainEventNotif: async
App\Message\UpdateDomainsFromWatchlist: async App\Message\UpdateDomainsFromWatchlist: async
App\Message\UpdateRdapServers: async App\Message\UpdateRdapServers: async

View File

@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20251025152900 extends AbstractMigration
{
public function getDescription(): string
{
return 'Rename WatchList to Watchlist';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT fk_f693e1d0d52d7aa6');
$this->addSql('ALTER TABLE watch_list DROP CONSTRAINT fk_152b584b4d085745');
$this->addSql('ALTER TABLE watch_list DROP CONSTRAINT fk_152b584ba76ed395');
$this->addSql('ALTER TABLE watch_list RENAME TO watchlist');
$this->addSql('ALTER INDEX idx_152b584ba76ed395 RENAME TO IDX_340388D3A76ED395');
$this->addSql('ALTER INDEX idx_152b584b4d085745 RENAME TO IDX_340388D34D085745');
$this->addSql('ALTER TABLE watchlist ADD CONSTRAINT FK_340388D3A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watchlist ADD CONSTRAINT FK_340388D34D085745 FOREIGN KEY (connector_id) REFERENCES connector (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT FK_F693E1D0D52D7AA6 FOREIGN KEY (watch_list_token) REFERENCES watchlist (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT fk_f693e1d0af923913');
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT fk_f693e1d0d52d7aa6');
$this->addSql('ALTER TABLE watch_lists_domains RENAME TO watchlist_domains');
$this->addSql('ALTER INDEX idx_f693e1d0af923913 RENAME TO IDX_196DE762AF923913');
$this->addSql('ALTER INDEX idx_f693e1d0d52d7aa6 RENAME TO IDX_196DE762F1E43AD7');
$this->addSql('ALTER TABLE watchlist_domains RENAME COLUMN watch_list_token TO watchlist_token');
$this->addSql('COMMENT ON COLUMN watchlist_domains.watchlist_token IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE watchlist_domains ADD CONSTRAINT FK_196DE762F1E43AD7 FOREIGN KEY (watchlist_token) REFERENCES watchlist (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watchlist_domains ADD CONSTRAINT FK_196DE762AF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT FK_F693E1D0D52D7AA6');
$this->addSql('ALTER TABLE watchlist DROP CONSTRAINT FK_340388D3A76ED395');
$this->addSql('ALTER TABLE watchlist DROP CONSTRAINT FK_340388D34D085745');
$this->addSql('ALTER TABLE watchlist RENAME TO watch_list');
$this->addSql('ALTER INDEX IDX_340388D3A76ED395 RENAME TO idx_152b584ba76ed395');
$this->addSql('ALTER INDEX IDX_340388D34D085745 RENAME TO idx_152b584b4d085745');
$this->addSql('ALTER TABLE watch_list ADD CONSTRAINT fk_152b584ba76ed395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_list ADD CONSTRAINT fk_152b584b4d085745 FOREIGN KEY (connector_id) REFERENCES connector (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT fk_f693e1d0d52d7aa6 FOREIGN KEY (watch_list_token) REFERENCES watch_list (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watchlist_domains DROP CONSTRAINT FK_196DE762F1E43AD7');
$this->addSql('ALTER TABLE watchlist_domains DROP CONSTRAINT FK_196DE762AF923913');
$this->addSql('ALTER TABLE watchlist_domains RENAME COLUMN watchlist_token TO watch_list_token');
$this->addSql('ALTER TABLE watchlist_domains RENAME TO watch_lists_domains');
$this->addSql('ALTER INDEX IDX_196DE762AF923913 RENAME TO idx_f693e1d0af923913');
$this->addSql('ALTER INDEX IDX_196DE762F1E43AD7 RENAME TO idx_f693e1d0d52d7aa6');
$this->addSql('COMMENT ON COLUMN watch_lists_domains.watch_list_token IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT fk_f693e1d0af923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT fk_f693e1d0d52d7aa6 FOREIGN KEY (watch_list_token) REFERENCES watchlist (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}

View File

@@ -2,7 +2,7 @@
namespace App\Command; namespace App\Command;
use App\Message\ProcessWatchListsTrigger; use App\Message\ProcessWatchlistTrigger;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@@ -12,10 +12,10 @@ use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\MessageBusInterface;
#[AsCommand( #[AsCommand(
name: 'app:process-watchlists', name: 'app:process-watchlist',
description: 'Process watchlists and send emails if necessary', description: 'Process watchlist and send emails if necessary',
)] )]
class ProcessWatchlistsCommand extends Command class ProcessWatchlistCommand extends Command
{ {
public function __construct(private readonly MessageBusInterface $bus) public function __construct(private readonly MessageBusInterface $bus)
{ {
@@ -33,7 +33,7 @@ class ProcessWatchlistsCommand extends Command
{ {
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
$this->bus->dispatch(new ProcessWatchListsTrigger()); $this->bus->dispatch(new ProcessWatchlistTrigger());
$io->success('Watchlist processing triggered!'); $io->success('Watchlist processing triggered!');

View File

@@ -2,7 +2,7 @@
namespace App\Command; namespace App\Command;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Message\SendDomainEventNotif; use App\Message\SendDomainEventNotif;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Service\RDAPService; use App\Service\RDAPService;
@@ -60,11 +60,11 @@ class RegisterDomainCommand extends Command
if ($notif) { if ($notif) {
$randomizer = new Randomizer(); $randomizer = new Randomizer();
$watchLists = $randomizer->shuffleArray($domain->getWatchLists()->toArray()); $watchlists = $randomizer->shuffleArray($domain->getWatchlists()->toArray());
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
foreach ($watchLists as $watchList) { foreach ($watchlists as $watchlist) {
$this->bus->dispatch(new SendDomainEventNotif($watchList->getToken(), $domain->getLdhName(), $updatedAt)); $this->bus->dispatch(new SendDomainEventNotif($watchlist->getToken(), $domain->getLdhName(), $updatedAt));
} }
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@@ -4,7 +4,7 @@ namespace App\Controller;
use App\Entity\Statistics; use App\Entity\Statistics;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use Psr\Cache\CacheItemPoolInterface; use Psr\Cache\CacheItemPoolInterface;
use Psr\Cache\InvalidArgumentException; use Psr\Cache\InvalidArgumentException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -15,7 +15,7 @@ class StatisticsController extends AbstractController
public function __construct( public function __construct(
private readonly CacheItemPoolInterface $pool, private readonly CacheItemPoolInterface $pool,
private readonly DomainRepository $domainRepository, private readonly DomainRepository $domainRepository,
private readonly WatchListRepository $watchListRepository, private readonly WatchlistRepository $watchlistRepository,
private readonly KernelInterface $kernel, private readonly KernelInterface $kernel,
) { ) {
} }
@@ -34,7 +34,7 @@ class StatisticsController extends AbstractController
->setAlertSent($this->pool->getItem('stats.alert.sent')->get() ?? 0) ->setAlertSent($this->pool->getItem('stats.alert.sent')->get() ?? 0)
->setDomainTracked( ->setDomainTracked(
$this->getCachedItem('stats.domain.tracked', fn () => $this->watchListRepository->getTrackedDomainCount()) $this->getCachedItem('stats.domain.tracked', fn () => $this->watchlistRepository->getTrackedDomainCount())
) )
->setDomainCount( ->setDomainCount(
$this->getCachedItem('stats.domain.count', fn () => $this->domainRepository->getActiveDomainCountByTld()) $this->getCachedItem('stats.domain.count', fn () => $this->domainRepository->getActiveDomainCountByTld())

View File

@@ -6,9 +6,9 @@ use App\Entity\Domain;
use App\Entity\DomainEvent; use App\Entity\DomainEvent;
use App\Entity\DomainStatus; use App\Entity\DomainStatus;
use App\Entity\User; use App\Entity\User;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use App\Service\CalendarService; use App\Service\CalendarService;
use App\Service\RDAPService; use App\Service\RDAPService;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
@@ -26,10 +26,10 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
class WatchListController extends AbstractController class WatchlistController extends AbstractController
{ {
public function __construct( public function __construct(
private readonly WatchListRepository $watchListRepository, private readonly WatchlistRepository $watchlistRepository,
private readonly RDAPService $RDAPService, private readonly RDAPService $RDAPService,
private readonly CalendarService $calendarService, private readonly CalendarService $calendarService,
private readonly DomainRepository $domainRepository, private readonly DomainRepository $domainRepository,
@@ -40,17 +40,17 @@ class WatchListController extends AbstractController
path: '/api/watchlists', path: '/api/watchlists',
name: 'watchlist_get_all_mine', name: 'watchlist_get_all_mine',
defaults: [ defaults: [
'_api_resource_class' => WatchList::class, '_api_resource_class' => Watchlist::class,
'_api_operation_name' => 'get_all_mine', '_api_operation_name' => 'get_all_mine',
], ],
methods: ['GET'] methods: ['GET']
)] )]
public function getWatchLists(): Collection public function getWatchlists(): Collection
{ {
/** @var User $user */ /** @var User $user */
$user = $this->getUser(); $user = $this->getUser();
return $user->getWatchLists(); return $user->getWatchlists();
} }
/** /**
@@ -63,26 +63,26 @@ class WatchListController extends AbstractController
path: '/api/watchlists/{token}/calendar', path: '/api/watchlists/{token}/calendar',
name: 'watchlist_calendar', name: 'watchlist_calendar',
defaults: [ defaults: [
'_api_resource_class' => WatchList::class, '_api_resource_class' => Watchlist::class,
'_api_operation_name' => 'calendar', '_api_operation_name' => 'calendar',
] ]
)] )]
public function getWatchlistCalendar(string $token): Response public function getWatchlistCalendar(string $token): Response
{ {
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
$watchList = $this->watchListRepository->findOneBy(['token' => $token]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $token]);
$calendar = new Calendar(); $calendar = new Calendar();
/** @var Domain $domain */ /** @var Domain $domain */
foreach ($watchList->getDomains()->getIterator() as $domain) { foreach ($watchlist->getDomains()->getIterator() as $domain) {
foreach ($this->calendarService->getDomainCalendarEvents($domain) as $event) { foreach ($this->calendarService->getDomainCalendarEvents($domain) as $event) {
$calendar->addEvent($event); $calendar->addEvent($event);
} }
} }
$calendarResponse = (new CalendarFactory())->createCalendar($calendar); $calendarResponse = (new CalendarFactory())->createCalendar($calendar);
$calendarName = $watchList->getName(); $calendarName = $watchlist->getName();
if (null !== $calendarName) { if (null !== $calendarName) {
$calendarResponse->withProperty(new Property('X-WR-CALNAME', new TextValue($calendarName))); $calendarResponse->withProperty(new Property('X-WR-CALNAME', new TextValue($calendarName)));
} }
@@ -99,7 +99,7 @@ class WatchListController extends AbstractController
path: '/api/tracked', path: '/api/tracked',
name: 'watchlist_get_tracked_domains', name: 'watchlist_get_tracked_domains',
defaults: [ defaults: [
'_api_resource_class' => WatchList::class, '_api_resource_class' => Watchlist::class,
'_api_operation_name' => 'get_tracked_domains', '_api_operation_name' => 'get_tracked_domains',
] ]
)] )]
@@ -125,14 +125,14 @@ class WatchListController extends AbstractController
path: '/api/watchlists/{token}/rss/events', path: '/api/watchlists/{token}/rss/events',
name: 'watchlist_rss_events', name: 'watchlist_rss_events',
defaults: [ defaults: [
'_api_resource_class' => WatchList::class, '_api_resource_class' => Watchlist::class,
'_api_operation_name' => 'rss_events', '_api_operation_name' => 'rss_events',
] ]
)] )]
public function getWatchlistRssEventsFeed(string $token, Request $request): Response public function getWatchlistRssEventsFeed(string $token, Request $request): Response
{ {
/** @var WatchList $watchlist */ /** @var Watchlist $watchlist */
$watchlist = $this->watchListRepository->findOneBy(['token' => $token]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $token]);
$feed = (new Feed()) $feed = (new Feed())
->setLanguage('en') ->setLanguage('en')
@@ -163,14 +163,14 @@ class WatchListController extends AbstractController
path: '/api/watchlists/{token}/rss/status', path: '/api/watchlists/{token}/rss/status',
name: 'watchlist_rss_status', name: 'watchlist_rss_status',
defaults: [ defaults: [
'_api_resource_class' => WatchList::class, '_api_resource_class' => Watchlist::class,
'_api_operation_name' => 'rss_status', '_api_operation_name' => 'rss_status',
] ]
)] )]
public function getWatchlistRssStatusFeed(string $token, Request $request): Response public function getWatchlistRssStatusFeed(string $token, Request $request): Response
{ {
/** @var WatchList $watchlist */ /** @var Watchlist $watchlist */
$watchlist = $this->watchListRepository->findOneBy(['token' => $token]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $token]);
$feed = (new Feed()) $feed = (new Feed())
->setLanguage('en') ->setLanguage('en')

View File

@@ -61,10 +61,10 @@ class Connector
private array $authData = []; private array $authData = [];
/** /**
* @var Collection<int, WatchList> * @var Collection<int, Watchlist>
*/ */
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'connector')] #[ORM\OneToMany(targetEntity: Watchlist::class, mappedBy: 'connector')]
private Collection $watchLists; private Collection $watchlists;
#[Groups(['connector:list', 'watchlist:list'])] #[Groups(['connector:list', 'watchlist:list'])]
#[ORM\Column] #[ORM\Column]
@@ -76,7 +76,7 @@ class Connector
public function __construct() public function __construct()
{ {
$this->id = Uuid::v4(); $this->id = Uuid::v4();
$this->watchLists = new ArrayCollection(); $this->watchlists = new ArrayCollection();
} }
public function getId(): ?string public function getId(): ?string
@@ -121,29 +121,29 @@ class Connector
} }
/** /**
* @return Collection<int, WatchList> * @return Collection<int, Watchlist>
*/ */
public function getWatchLists(): Collection public function getWatchlists(): Collection
{ {
return $this->watchLists; return $this->watchlists;
} }
public function addWatchList(WatchList $watchList): static public function addWatchlist(Watchlist $watchlist): static
{ {
if (!$this->watchLists->contains($watchList)) { if (!$this->watchlists->contains($watchlist)) {
$this->watchLists->add($watchList); $this->watchlists->add($watchlist);
$watchList->setConnector($this); $watchlist->setConnector($this);
} }
return $this; return $this;
} }
public function removeWatchList(WatchList $watchList): static public function removeWatchlist(Watchlist $watchlist): static
{ {
if ($this->watchLists->removeElement($watchList)) { if ($this->watchlists->removeElement($watchlist)) {
// set the owning side to null (unless already changed) // set the owning side to null (unless already changed)
if ($watchList->getConnector() === $this) { if ($watchlist->getConnector() === $this) {
$watchList->setConnector(null); $watchlist->setConnector(null);
} }
} }
@@ -164,6 +164,6 @@ class Connector
public function getWatchlistCount(): ?int public function getWatchlistCount(): ?int
{ {
return $this->watchLists->count(); return $this->watchlists->count();
} }
} }

View File

@@ -82,10 +82,10 @@ class Domain
private array $status = []; private array $status = [];
/** /**
* @var Collection<int, WatchList> * @var Collection<int, Watchlist>
*/ */
#[ORM\ManyToMany(targetEntity: WatchList::class, mappedBy: 'domains', cascade: ['persist'])] #[ORM\ManyToMany(targetEntity: Watchlist::class, mappedBy: 'domains', cascade: ['persist'])]
private Collection $watchLists; private Collection $watchlists;
/** /**
* @var Collection<int, Nameserver> * @var Collection<int, Nameserver>
@@ -154,7 +154,7 @@ class Domain
{ {
$this->events = new ArrayCollection(); $this->events = new ArrayCollection();
$this->domainEntities = new ArrayCollection(); $this->domainEntities = new ArrayCollection();
$this->watchLists = new ArrayCollection(); $this->watchlists = new ArrayCollection();
$this->nameservers = new ArrayCollection(); $this->nameservers = new ArrayCollection();
$this->updatedAt = new \DateTimeImmutable('now'); $this->updatedAt = new \DateTimeImmutable('now');
$this->createdAt = $this->updatedAt; $this->createdAt = $this->updatedAt;
@@ -263,27 +263,27 @@ class Domain
} }
/** /**
* @return Collection<int, WatchList> * @return Collection<int, Watchlist>
*/ */
public function getWatchLists(): Collection public function getWatchlists(): Collection
{ {
return $this->watchLists; return $this->watchlists;
} }
public function addWatchList(WatchList $watchList): static public function addWatchlists(Watchlist $watchlist): static
{ {
if (!$this->watchLists->contains($watchList)) { if (!$this->watchlists->contains($watchlist)) {
$this->watchLists->add($watchList); $this->watchlists->add($watchlist);
$watchList->addDomain($this); $watchlist->addDomain($this);
} }
return $this; return $this;
} }
public function removeWatchList(WatchList $watchList): static public function removeWatchlists(Watchlist $watchlist): static
{ {
if ($this->watchLists->removeElement($watchList)) { if ($this->watchlists->removeElement($watchlist)) {
$watchList->removeDomain($this); $watchlist->removeDomain($this);
} }
return $this; return $this;

View File

@@ -66,10 +66,10 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private ?string $password = null; private ?string $password = null;
/** /**
* @var Collection<int, WatchList> * @var Collection<int, Watchlist>
*/ */
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'user', orphanRemoval: true)] #[ORM\OneToMany(targetEntity: Watchlist::class, mappedBy: 'user', orphanRemoval: true)]
private Collection $watchLists; private Collection $watchlists;
/** /**
* @var Collection<int, Connector> * @var Collection<int, Connector>
@@ -91,7 +91,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
public function __construct() public function __construct()
{ {
$this->watchLists = new ArrayCollection(); $this->watchlists = new ArrayCollection();
$this->connectors = new ArrayCollection(); $this->connectors = new ArrayCollection();
} }
@@ -168,29 +168,29 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
} }
/** /**
* @return Collection<int, WatchList> * @return Collection<int, Watchlist>
*/ */
public function getWatchLists(): Collection public function getWatchlists(): Collection
{ {
return $this->watchLists; return $this->watchlists;
} }
public function addWatchList(WatchList $watchList): static public function addWatchlist(Watchlist $watchlist): static
{ {
if (!$this->watchLists->contains($watchList)) { if (!$this->watchlists->contains($watchlist)) {
$this->watchLists->add($watchList); $this->watchlists->add($watchlist);
$watchList->setUser($this); $watchlist->setUser($this);
} }
return $this; return $this;
} }
public function removeWatchList(WatchList $watchList): static public function removeWatchlist(Watchlist $watchlist): static
{ {
if ($this->watchLists->removeElement($watchList)) { if ($this->watchlists->removeElement($watchlist)) {
// set the owning side to null (unless already changed) // set the owning side to null (unless already changed)
if ($watchList->getUser() === $this) { if ($watchlist->getUser() === $this) {
$watchList->setUser(null); $watchlist->setUser(null);
} }
} }

View File

@@ -8,8 +8,8 @@ use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put; use ApiPlatform\Metadata\Put;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use App\State\WatchListUpdateProcessor; use App\State\WatchlistUpdateProcessor;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
@@ -19,7 +19,7 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
use Symfony\Component\Uid\Uuid; use Symfony\Component\Uid\Uuid;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: WatchListRepository::class)] #[ORM\Entity(repositoryClass: WatchlistRepository::class)]
#[ApiResource( #[ApiResource(
shortName: 'Watchlist', shortName: 'Watchlist',
operations: [ operations: [
@@ -87,13 +87,13 @@ use Symfony\Component\Validator\Constraints as Assert;
new Post( new Post(
normalizationContext: ['groups' => 'watchlist:list'], normalizationContext: ['groups' => 'watchlist:list'],
denormalizationContext: ['groups' => 'watchlist:create'], denormalizationContext: ['groups' => 'watchlist:create'],
processor: WatchListUpdateProcessor::class, processor: WatchlistUpdateProcessor::class,
), ),
new Put( new Put(
normalizationContext: ['groups' => 'watchlist:list'], normalizationContext: ['groups' => 'watchlist:list'],
denormalizationContext: ['groups' => ['watchlist:update']], denormalizationContext: ['groups' => ['watchlist:update']],
security: 'object.getUser() == user', security: 'object.getUser() == user',
processor: WatchListUpdateProcessor::class, processor: WatchlistUpdateProcessor::class,
), ),
new Delete( new Delete(
security: 'object.getUser() == user' security: 'object.getUser() == user'
@@ -146,9 +146,9 @@ use Symfony\Component\Validator\Constraints as Assert;
), ),
], ],
)] )]
class WatchList class Watchlist
{ {
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchLists')] #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchlists')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
public ?User $user = null; public ?User $user = null;
@@ -160,14 +160,14 @@ class WatchList
/** /**
* @var Collection<int, Domain> * @var Collection<int, Domain>
*/ */
#[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'watchLists')] #[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'watchlists')]
#[ORM\JoinTable(name: 'watch_lists_domains', #[ORM\JoinTable(name: 'watchlist_domains',
joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token', onDelete: 'CASCADE')], joinColumns: [new ORM\JoinColumn(name: 'watchlist_token', referencedColumnName: 'token', onDelete: 'CASCADE')],
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name', onDelete: 'CASCADE')])] inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name', onDelete: 'CASCADE')])]
#[Groups(['watchlist:create', 'watchlist:list', 'watchlist:item', 'watchlist:update'])] #[Groups(['watchlist:create', 'watchlist:list', 'watchlist:item', 'watchlist:update'])]
private Collection $domains; private Collection $domains;
#[ORM\ManyToOne(inversedBy: 'watchLists')] #[ORM\ManyToOne(inversedBy: 'watchlists')]
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])] #[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])]
private ?Connector $connector = null; private ?Connector $connector = null;

View File

@@ -5,7 +5,7 @@ namespace App\Message;
final class OrderDomain final class OrderDomain
{ {
public function __construct( public function __construct(
public string $watchListToken, public string $watchlistToken,
public string $ldhName, public string $ldhName,
) { ) {
} }

View File

@@ -2,7 +2,7 @@
namespace App\Message; namespace App\Message;
final class ProcessWatchListsTrigger final class ProcessWatchlistTrigger
{ {
/* /*
* Add whatever properties and methods you need * Add whatever properties and methods you need

View File

@@ -5,7 +5,7 @@ namespace App\Message;
final class SendDomainEventNotif final class SendDomainEventNotif
{ {
public function __construct( public function __construct(
public string $watchListToken, public string $watchlistToken,
public string $ldhName, public string $ldhName,
public \DateTimeImmutable $updatedAt, public \DateTimeImmutable $updatedAt,
) { ) {

View File

@@ -5,7 +5,7 @@ namespace App\Message;
final readonly class UpdateDomainsFromWatchlist final readonly class UpdateDomainsFromWatchlist
{ {
public function __construct( public function __construct(
public string $watchListToken, public string $watchlistToken,
) { ) {
} }
} }

View File

@@ -3,12 +3,12 @@
namespace App\MessageHandler; namespace App\MessageHandler;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Message\OrderDomain; use App\Message\OrderDomain;
use App\Notifier\DomainOrderErrorNotification; use App\Notifier\DomainOrderErrorNotification;
use App\Notifier\DomainOrderNotification; use App\Notifier\DomainOrderNotification;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use App\Service\ChatNotificationService; use App\Service\ChatNotificationService;
use App\Service\InfluxdbService; use App\Service\InfluxdbService;
use App\Service\Provider\AbstractProvider; use App\Service\Provider\AbstractProvider;
@@ -31,7 +31,7 @@ final readonly class OrderDomainHandler
public function __construct( public function __construct(
string $mailerSenderEmail, string $mailerSenderEmail,
string $mailerSenderName, string $mailerSenderName,
private WatchListRepository $watchListRepository, private WatchlistRepository $watchlistRepository,
private DomainRepository $domainRepository, private DomainRepository $domainRepository,
private KernelInterface $kernel, private KernelInterface $kernel,
private MailerInterface $mailer, private MailerInterface $mailer,
@@ -54,12 +54,12 @@ final readonly class OrderDomainHandler
*/ */
public function __invoke(OrderDomain $message): void public function __invoke(OrderDomain $message): void
{ {
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
$watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $message->watchlistToken]);
/** @var Domain $domain */ /** @var Domain $domain */
$domain = $this->domainRepository->findOneBy(['ldhName' => $message->ldhName]); $domain = $this->domainRepository->findOneBy(['ldhName' => $message->ldhName]);
$connector = $watchList->getConnector(); $connector = $watchlist->getConnector();
/* /*
* We make sure that the domain name is marked absent from WHOIS in the database before continuing. * We make sure that the domain name is marked absent from WHOIS in the database before continuing.
@@ -72,7 +72,7 @@ final readonly class OrderDomainHandler
} }
$this->logger->notice('Watchlist is linked to a connector : a purchase attempt will be made for this domain name', [ $this->logger->notice('Watchlist is linked to a connector : a purchase attempt will be made for this domain name', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchlistToken,
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'provider' => $connector->getProvider()->value, 'provider' => $connector->getProvider()->value,
@@ -101,7 +101,7 @@ final readonly class OrderDomainHandler
* If the purchase was successful, the statistics are updated and a success message is sent to the user. * If the purchase was successful, the statistics are updated and a success message is sent to the user.
*/ */
$this->logger->notice('Watchlist is linked to connector : a purchase was successfully made for this domain name', [ $this->logger->notice('Watchlist is linked to connector : a purchase was successfully made for this domain name', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchlistToken,
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'provider' => $connector->getProvider()->value, 'provider' => $connector->getProvider()->value,
@@ -112,15 +112,15 @@ final readonly class OrderDomainHandler
$this->influxdbService->addDomainOrderPoint($connector, $domain, true); $this->influxdbService->addDomainOrderPoint($connector, $domain, true);
} }
$notification = (new DomainOrderNotification($this->sender, $domain, $connector)); $notification = (new DomainOrderNotification($this->sender, $domain, $connector));
$this->mailer->send($notification->asEmailMessage(new Recipient($watchList->getUser()->getEmail()))->getMessage()); $this->mailer->send($notification->asEmailMessage(new Recipient($watchlist->getUser()->getEmail()))->getMessage());
$this->chatNotificationService->sendChatNotification($watchList, $notification); $this->chatNotificationService->sendChatNotification($watchlist, $notification);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
/* /*
* The purchase was not successful (for several possible reasons that we have not determined). * The purchase was not successful (for several possible reasons that we have not determined).
* The user is informed and the exception is raised, which may allow you to try again. * The user is informed and the exception is raised, which may allow you to try again.
*/ */
$this->logger->warning('Unable to complete purchase : an error message is sent to the user', [ $this->logger->warning('Unable to complete purchase : an error message is sent to the user', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchlistToken,
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'provider' => $connector->getProvider()->value, 'provider' => $connector->getProvider()->value,
@@ -131,8 +131,8 @@ final readonly class OrderDomainHandler
$this->influxdbService->addDomainOrderPoint($connector, $domain, false); $this->influxdbService->addDomainOrderPoint($connector, $domain, false);
} }
$notification = (new DomainOrderErrorNotification($this->sender, $domain)); $notification = (new DomainOrderErrorNotification($this->sender, $domain));
$this->mailer->send($notification->asEmailMessage(new Recipient($watchList->getUser()->getEmail()))->getMessage()); $this->mailer->send($notification->asEmailMessage(new Recipient($watchlist->getUser()->getEmail()))->getMessage());
$this->chatNotificationService->sendChatNotification($watchList, $notification); $this->chatNotificationService->sendChatNotification($watchlist, $notification);
throw $exception; throw $exception;
} }

View File

@@ -2,20 +2,20 @@
namespace App\MessageHandler; namespace App\MessageHandler;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Message\ProcessWatchListsTrigger; use App\Message\ProcessWatchlistTrigger;
use App\Message\UpdateDomainsFromWatchlist; use App\Message\UpdateDomainsFromWatchlist;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use Random\Randomizer; use Random\Randomizer;
use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\ExceptionInterface; use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\MessageBusInterface;
#[AsMessageHandler] #[AsMessageHandler]
final readonly class ProcessWatchListsTriggerHandler final readonly class ProcessWatchlistTriggerHandler
{ {
public function __construct( public function __construct(
private WatchListRepository $watchListRepository, private WatchlistRepository $watchlistRepository,
private MessageBusInterface $bus, private MessageBusInterface $bus,
) { ) {
} }
@@ -23,7 +23,7 @@ final readonly class ProcessWatchListsTriggerHandler
/** /**
* @throws ExceptionInterface * @throws ExceptionInterface
*/ */
public function __invoke(ProcessWatchListsTrigger $message): void public function __invoke(ProcessWatchlistTrigger $message): void
{ {
/* /*
* We shuffle the watch lists to process them in an order that we consider random. * We shuffle the watch lists to process them in an order that we consider random.
@@ -31,11 +31,11 @@ final readonly class ProcessWatchListsTriggerHandler
*/ */
$randomizer = new Randomizer(); $randomizer = new Randomizer();
$watchLists = $randomizer->shuffleArray($this->watchListRepository->findAll()); $watchlists = $randomizer->shuffleArray($this->watchlistRepository->findAll());
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
foreach ($watchLists as $watchList) { foreach ($watchlists as $watchlist) {
$this->bus->dispatch(new UpdateDomainsFromWatchlist($watchList->getToken())); $this->bus->dispatch(new UpdateDomainsFromWatchlist($watchlist->getToken()));
} }
} }
} }

View File

@@ -5,14 +5,14 @@ namespace App\MessageHandler;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\DomainEvent; use App\Entity\DomainEvent;
use App\Entity\DomainStatus; use App\Entity\DomainStatus;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Message\SendDomainEventNotif; use App\Message\SendDomainEventNotif;
use App\Notifier\DomainStatusUpdateNotification; use App\Notifier\DomainStatusUpdateNotification;
use App\Notifier\DomainUpdateNotification; use App\Notifier\DomainUpdateNotification;
use App\Repository\DomainEventRepository; use App\Repository\DomainEventRepository;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Repository\DomainStatusRepository; use App\Repository\DomainStatusRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use App\Service\ChatNotificationService; use App\Service\ChatNotificationService;
use App\Service\InfluxdbService; use App\Service\InfluxdbService;
use App\Service\StatService; use App\Service\StatService;
@@ -36,7 +36,7 @@ final readonly class SendDomainEventNotifHandler
private MailerInterface $mailer, private MailerInterface $mailer,
private StatService $statService, private StatService $statService,
private DomainRepository $domainRepository, private DomainRepository $domainRepository,
private WatchListRepository $watchListRepository, private WatchlistRepository $watchlistRepository,
private ChatNotificationService $chatNotificationService, private ChatNotificationService $chatNotificationService,
#[Autowire(param: 'influxdb_enabled')] #[Autowire(param: 'influxdb_enabled')]
private bool $influxdbEnabled, private bool $influxdbEnabled,
@@ -53,11 +53,11 @@ final readonly class SendDomainEventNotifHandler
*/ */
public function __invoke(SendDomainEventNotif $message): void public function __invoke(SendDomainEventNotif $message): void
{ {
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
$watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $message->watchlistToken]);
/** @var Domain $domain */ /** @var Domain $domain */
$domain = $this->domainRepository->findOneBy(['ldhName' => $message->ldhName]); $domain = $this->domainRepository->findOneBy(['ldhName' => $message->ldhName]);
$recipient = new Recipient($watchList->getUser()->getEmail()); $recipient = new Recipient($watchlist->getUser()->getEmail());
/* /*
* For each new event whose date is after the domain name update date (before the current domain name update) * For each new event whose date is after the domain name update date (before the current domain name update)
@@ -67,7 +67,7 @@ final readonly class SendDomainEventNotifHandler
$newEvents = $this->domainEventRepository->findNewDomainEvents($domain, $message->updatedAt); $newEvents = $this->domainEventRepository->findNewDomainEvents($domain, $message->updatedAt);
foreach ($newEvents as $event) { foreach ($newEvents as $event) {
if (!in_array($event->getAction(), $watchList->getTrackedEvents())) { if (!in_array($event->getAction(), $watchlist->getTrackedEvents())) {
continue; continue;
} }
@@ -76,7 +76,7 @@ final readonly class SendDomainEventNotifHandler
$this->logger->info('New action has been detected on this domain name : an email is sent to user', [ $this->logger->info('New action has been detected on this domain name : an email is sent to user', [
'event' => $event->getAction(), 'event' => $event->getAction(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchlist->getUser()->getUserIdentifier(),
]); ]);
$this->mailer->send($notification->asEmailMessage($recipient)->getMessage()); $this->mailer->send($notification->asEmailMessage($recipient)->getMessage());
@@ -85,15 +85,15 @@ final readonly class SendDomainEventNotifHandler
$this->influxdbService->addDomainNotificationPoint($domain, 'email', true); $this->influxdbService->addDomainNotificationPoint($domain, 'email', true);
} }
$webhookDsn = $watchList->getWebhookDsn(); $webhookDsn = $watchlist->getWebhookDsn();
if (null !== $webhookDsn && 0 !== count($webhookDsn)) { if (null !== $webhookDsn && 0 !== count($webhookDsn)) {
$this->logger->info('New action has been detected on this domain name : a notification is sent to user', [ $this->logger->info('New action has been detected on this domain name : a notification is sent to user', [
'event' => $event->getAction(), 'event' => $event->getAction(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchlist->getUser()->getUserIdentifier(),
]); ]);
$this->chatNotificationService->sendChatNotification($watchList, $notification); $this->chatNotificationService->sendChatNotification($watchlist, $notification);
if ($this->influxdbEnabled) { if ($this->influxdbEnabled) {
$this->influxdbService->addDomainNotificationPoint($domain, 'chat', true); $this->influxdbService->addDomainNotificationPoint($domain, 'chat', true);
} }
@@ -106,7 +106,7 @@ final readonly class SendDomainEventNotifHandler
$domainStatus = $this->domainStatusRepository->findNewDomainStatus($domain, $message->updatedAt); $domainStatus = $this->domainStatusRepository->findNewDomainStatus($domain, $message->updatedAt);
if (null !== $domainStatus && count(array_intersect( if (null !== $domainStatus && count(array_intersect(
$watchList->getTrackedEppStatus(), $watchlist->getTrackedEppStatus(),
[...$domainStatus->getAddStatus(), ...$domainStatus->getDeleteStatus()] [...$domainStatus->getAddStatus(), ...$domainStatus->getDeleteStatus()]
))) { ))) {
$notification = new DomainStatusUpdateNotification($this->sender, $domain, $domainStatus); $notification = new DomainStatusUpdateNotification($this->sender, $domain, $domainStatus);
@@ -116,7 +116,7 @@ final readonly class SendDomainEventNotifHandler
'deleteStatus' => $domainStatus->getDeleteStatus(), 'deleteStatus' => $domainStatus->getDeleteStatus(),
'status' => $domain->getStatus(), 'status' => $domain->getStatus(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchlist->getUser()->getUserIdentifier(),
]); ]);
$this->mailer->send($notification->asEmailMessage($recipient)->getMessage()); $this->mailer->send($notification->asEmailMessage($recipient)->getMessage());
@@ -125,17 +125,17 @@ final readonly class SendDomainEventNotifHandler
$this->influxdbService->addDomainNotificationPoint($domain, 'email', true); $this->influxdbService->addDomainNotificationPoint($domain, 'email', true);
} }
$webhookDsn = $watchList->getWebhookDsn(); $webhookDsn = $watchlist->getWebhookDsn();
if (null !== $webhookDsn && 0 !== count($webhookDsn)) { if (null !== $webhookDsn && 0 !== count($webhookDsn)) {
$this->logger->info('New domain status has been detected on this domain name : a notification is sent to user', [ $this->logger->info('New domain status has been detected on this domain name : a notification is sent to user', [
'addStatus' => $domainStatus->getAddStatus(), 'addStatus' => $domainStatus->getAddStatus(),
'deleteStatus' => $domainStatus->getDeleteStatus(), 'deleteStatus' => $domainStatus->getDeleteStatus(),
'status' => $domain->getStatus(), 'status' => $domain->getStatus(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchlist->getUser()->getUserIdentifier(),
]); ]);
$this->chatNotificationService->sendChatNotification($watchList, $notification); $this->chatNotificationService->sendChatNotification($watchlist, $notification);
if ($this->influxdbEnabled) { if ($this->influxdbEnabled) {
$this->influxdbService->addDomainNotificationPoint($domain, 'chat', true); $this->influxdbService->addDomainNotificationPoint($domain, 'chat', true);

View File

@@ -3,7 +3,7 @@
namespace App\MessageHandler; namespace App\MessageHandler;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Exception\DomainNotFoundException; use App\Exception\DomainNotFoundException;
use App\Exception\TldNotSupportedException; use App\Exception\TldNotSupportedException;
use App\Exception\UnknownRdapServerException; use App\Exception\UnknownRdapServerException;
@@ -12,7 +12,7 @@ use App\Message\SendDomainEventNotif;
use App\Message\UpdateDomainsFromWatchlist; use App\Message\UpdateDomainsFromWatchlist;
use App\Notifier\DomainDeletedNotification; use App\Notifier\DomainDeletedNotification;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchlistRepository;
use App\Service\ChatNotificationService; use App\Service\ChatNotificationService;
use App\Service\Provider\AbstractProvider; use App\Service\Provider\AbstractProvider;
use App\Service\Provider\CheckDomainProviderInterface; use App\Service\Provider\CheckDomainProviderInterface;
@@ -38,7 +38,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
string $mailerSenderEmail, string $mailerSenderEmail,
string $mailerSenderName, string $mailerSenderName,
private MessageBusInterface $bus, private MessageBusInterface $bus,
private WatchListRepository $watchListRepository, private WatchlistRepository $watchlistRepository,
private LoggerInterface $logger, private LoggerInterface $logger,
#[Autowire(service: 'service_container')] #[Autowire(service: 'service_container')]
private ContainerInterface $locator, private ContainerInterface $locator,
@@ -52,29 +52,29 @@ final readonly class UpdateDomainsFromWatchlistHandler
*/ */
public function __invoke(UpdateDomainsFromWatchlist $message): void public function __invoke(UpdateDomainsFromWatchlist $message): void
{ {
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
$watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]); $watchlist = $this->watchlistRepository->findOneBy(['token' => $message->watchlistToken]);
$this->logger->debug('Domain names listed in the Watchlist will be updated', [ $this->logger->debug('Domain names listed in the Watchlist will be updated', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchlistToken,
]); ]);
/** @var AbstractProvider $connectorProvider */ /** @var AbstractProvider $connectorProvider */
$connectorProvider = $this->getConnectorProvider($watchList); $connectorProvider = $this->getConnectorProvider($watchlist);
if ($connectorProvider instanceof CheckDomainProviderInterface) { if ($connectorProvider instanceof CheckDomainProviderInterface) {
$this->logger->debug('Watchlist is linked to a connector', [ $this->logger->debug('Watchlist is linked to a connector', [
'watchlist' => $watchList->getToken(), 'watchlist' => $watchlist->getToken(),
'connector' => $watchList->getConnector()->getId(), 'connector' => $watchlist->getConnector()->getId(),
]); ]);
$domainList = array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray())); $domainList = array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchlist->getDomains()->toArray()));
try { try {
$checkedDomains = $connectorProvider->checkDomains(...$domainList); $checkedDomains = $connectorProvider->checkDomains(...$domainList);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$this->logger->warning('Unable to check domain names availability with this connector', [ $this->logger->warning('Unable to check domain names availability with this connector', [
'connector' => $watchList->getConnector()->getId(), 'connector' => $watchlist->getConnector()->getId(),
'ldhName' => $domainList, 'ldhName' => $domainList,
]); ]);
@@ -82,7 +82,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
} }
foreach ($checkedDomains as $domain) { foreach ($checkedDomains as $domain) {
$this->bus->dispatch(new OrderDomain($watchList->getToken(), $domain)); $this->bus->dispatch(new OrderDomain($watchlist->getToken(), $domain));
} }
return; return;
@@ -96,7 +96,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
*/ */
/** @var Domain $domain */ /** @var Domain $domain */
foreach ($watchList->getDomains()->filter(fn ($domain) => $this->RDAPService->isToBeUpdated($domain, false, null !== $watchList->getConnector())) as $domain foreach ($watchlist->getDomains()->filter(fn ($domain) => $this->RDAPService->isToBeUpdated($domain, false, null !== $watchlist->getConnector())) as $domain
) { ) {
$updatedAt = $domain->getUpdatedAt(); $updatedAt = $domain->getUpdatedAt();
$deleted = $domain->getDeleted(); $deleted = $domain->getDeleted();
@@ -107,22 +107,22 @@ final readonly class UpdateDomainsFromWatchlistHandler
* We send messages that correspond to the sending of notifications that will not be processed here. * We send messages that correspond to the sending of notifications that will not be processed here.
*/ */
$this->RDAPService->registerDomain($domain->getLdhName()); $this->RDAPService->registerDomain($domain->getLdhName());
$this->bus->dispatch(new SendDomainEventNotif($watchList->getToken(), $domain->getLdhName(), $updatedAt)); $this->bus->dispatch(new SendDomainEventNotif($watchlist->getToken(), $domain->getLdhName(), $updatedAt));
} catch (DomainNotFoundException) { } catch (DomainNotFoundException) {
$newDomain = $this->domainRepository->findOneBy(['ldhName' => $domain->getLdhName()]); $newDomain = $this->domainRepository->findOneBy(['ldhName' => $domain->getLdhName()]);
if (!$deleted && null !== $newDomain && $newDomain->getDeleted()) { if (!$deleted && null !== $newDomain && $newDomain->getDeleted()) {
$notification = new DomainDeletedNotification($this->sender, $domain); $notification = new DomainDeletedNotification($this->sender, $domain);
$this->mailer->send($notification->asEmailMessage(new Recipient($watchList->getUser()->getEmail()))->getMessage()); $this->mailer->send($notification->asEmailMessage(new Recipient($watchlist->getUser()->getEmail()))->getMessage());
$this->chatNotificationService->sendChatNotification($watchList, $notification); $this->chatNotificationService->sendChatNotification($watchlist, $notification);
} }
if ($watchList->getConnector()) { if ($watchlist->getConnector()) {
/* /*
* If the domain name no longer appears in the WHOIS AND a connector is associated with this Watchlist, * If the domain name no longer appears in the WHOIS AND a connector is associated with this Watchlist,
* this connector is used to purchase the domain name. * this connector is used to purchase the domain name.
*/ */
$this->bus->dispatch(new OrderDomain($watchList->getToken(), $domain->getLdhName())); $this->bus->dispatch(new OrderDomain($watchlist->getToken(), $domain->getLdhName()));
} }
} catch (TldNotSupportedException|UnknownRdapServerException) { } catch (TldNotSupportedException|UnknownRdapServerException) {
/* /*
@@ -132,9 +132,9 @@ final readonly class UpdateDomainsFromWatchlistHandler
} }
} }
private function getConnectorProvider(WatchList $watchList): ?object private function getConnectorProvider(Watchlist $watchlist): ?object
{ {
$connector = $watchList->getConnector(); $connector = $watchlist->getConnector();
if (null === $connector || null === $connector->getProvider()) { if (null === $connector || null === $connector->getProvider()) {
return null; return null;
} }

View File

@@ -27,7 +27,7 @@ class DomainUpdateNotification extends DomainWatchdogNotification
$ldhName = $this->domainEvent->getDomain()->getLdhName(); $ldhName = $this->domainEvent->getDomain()->getLdhName();
$action = $this->domainEvent->getAction(); $action = $this->domainEvent->getAction();
$this->subject("Domain changed $ldhName ($action)") $this->subject("Domain changed $ldhName ($action)")
->content("Domain name $ldhName information has been updated ($action).") ->content("Domain name $ldhName events has been updated ($action).")
->importance(Notification::IMPORTANCE_HIGH); ->importance(Notification::IMPORTANCE_HIGH);
return ChatMessage::fromNotification($this); return ChatMessage::fromNotification($this);
@@ -38,7 +38,7 @@ class DomainUpdateNotification extends DomainWatchdogNotification
$ldhName = $this->domainEvent->getDomain()->getLdhName(); $ldhName = $this->domainEvent->getDomain()->getLdhName();
$action = $this->domainEvent->getAction(); $action = $this->domainEvent->getAction();
$this->subject("Domain changed $ldhName ($action)") $this->subject("Domain changed $ldhName ($action)")
->content("Domain name $ldhName information has been updated ($action).") ->content("Domain name $ldhName events has been updated ($action).")
->importance(Notification::IMPORTANCE_HIGH); ->importance(Notification::IMPORTANCE_HIGH);
return PushMessage::fromNotification($this); return PushMessage::fromNotification($this);
@@ -52,8 +52,8 @@ class DomainUpdateNotification extends DomainWatchdogNotification
->from($this->sender) ->from($this->sender)
->to($recipient->getEmail()) ->to($recipient->getEmail())
->priority(Email::PRIORITY_HIGH) ->priority(Email::PRIORITY_HIGH)
->subject("Domain name $ldhName information has been updated") ->subject("Domain name $ldhName events has been updated")
->htmlTemplate('emails/success/domain_updated.html.twig') ->htmlTemplate('emails/success/domain_event_updated.html.twig')
->locale('en') ->locale('en')
->context([ ->context([
'event' => $this->domainEvent, 'event' => $this->domainEvent,

View File

@@ -55,7 +55,7 @@ class DomainRepository extends ServiceEntityRepository
public function getMyTrackedDomains(User $user): array public function getMyTrackedDomains(User $user): array
{ {
return $this->createQueryBuilder('d') return $this->createQueryBuilder('d')
->join('d.watchLists', 'w') ->join('d.watchlists', 'w')
->where('w.user = :user') ->where('w.user = :user')
->andWhere('d.deleted = false') ->andWhere('d.deleted = false')
->setParameter('user', $user) ->setParameter('user', $user)

View File

@@ -2,18 +2,18 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\WatchList; use App\Entity\Watchlist;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
/** /**
* @extends ServiceEntityRepository<WatchList> * @extends ServiceEntityRepository<Watchlist>
*/ */
class WatchListRepository extends ServiceEntityRepository class WatchlistRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, WatchList::class); parent::__construct($registry, Watchlist::class);
} }
public function getTrackedDomainCount() public function getTrackedDomainCount()
@@ -26,7 +26,7 @@ class WatchListRepository extends ServiceEntityRepository
} }
// /** // /**
// * @return WatchList[] Returns an array of WatchList objects // * @return Watchlist[] Returns an array of Watchlist objects
// */ // */
// public function findByExampleField($value): array // public function findByExampleField($value): array
// { // {
@@ -40,7 +40,7 @@ class WatchListRepository extends ServiceEntityRepository
// ; // ;
// } // }
// public function findOneBySomeField($value): ?WatchList // public function findOneBySomeField($value): ?Watchlist
// { // {
// return $this->createQueryBuilder('b') // return $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val') // ->andWhere('b.exampleField = :val')

View File

@@ -2,7 +2,7 @@
namespace App\Scheduler; namespace App\Scheduler;
use App\Message\ProcessWatchListsTrigger; use App\Message\ProcessWatchlistTrigger;
use Symfony\Component\Scheduler\Attribute\AsSchedule; use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\RecurringMessage; use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule; use Symfony\Component\Scheduler\Schedule;
@@ -10,7 +10,7 @@ use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\CacheInterface;
#[AsSchedule('notif_watchlist')] #[AsSchedule('notif_watchlist')]
final readonly class SendNotifWatchListTriggerSchedule implements ScheduleProviderInterface final readonly class SendNotifWatchlistTriggerSchedule implements ScheduleProviderInterface
{ {
public function __construct( public function __construct(
private CacheInterface $cache, private CacheInterface $cache,
@@ -21,7 +21,7 @@ final readonly class SendNotifWatchListTriggerSchedule implements ScheduleProvid
{ {
return (new Schedule()) return (new Schedule())
->add( ->add(
RecurringMessage::every('5 minutes', new ProcessWatchListsTrigger()), RecurringMessage::every('5 minutes', new ProcessWatchlistTrigger()),
) )
->stateful($this->cache); ->stateful($this->cache);
} }

View File

@@ -3,7 +3,7 @@
namespace App\Service; namespace App\Service;
use App\Config\WebhookScheme; use App\Config\WebhookScheme;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Exception\UnsupportedDsnSchemeException; use App\Exception\UnsupportedDsnSchemeException;
use App\Notifier\DomainWatchdogNotification; use App\Notifier\DomainWatchdogNotification;
use Symfony\Component\Notifier\Exception\TransportExceptionInterface; use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
@@ -21,9 +21,9 @@ readonly class ChatNotificationService
* @throws UnsupportedDsnSchemeException * @throws UnsupportedDsnSchemeException
* @throws TransportExceptionInterface * @throws TransportExceptionInterface
*/ */
public function sendChatNotification(WatchList $watchList, DomainWatchdogNotification $notification): void public function sendChatNotification(Watchlist $watchlist, DomainWatchdogNotification $notification): void
{ {
$webhookDsn = $watchList->getWebhookDsn(); $webhookDsn = $watchlist->getWebhookDsn();
if (empty($webhookDsn)) { if (empty($webhookDsn)) {
return; return;

View File

@@ -5,7 +5,7 @@ namespace App\State;
use ApiPlatform\Metadata\Operation; use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface; use ApiPlatform\State\ProviderInterface;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Exception\DomainNotFoundException; use App\Exception\DomainNotFoundException;
use App\Exception\MalformedDomainException; use App\Exception\MalformedDomainException;
use App\Exception\TldNotSupportedException; use App\Exception\TldNotSupportedException;
@@ -100,11 +100,11 @@ readonly class AutoRegisterDomainProvider implements ProviderInterface
$domain = $this->RDAPService->registerDomain($idnDomain); $domain = $this->RDAPService->registerDomain($idnDomain);
$randomizer = new Randomizer(); $randomizer = new Randomizer();
$watchLists = $randomizer->shuffleArray($domain->getWatchLists()->toArray()); $watchlists = $randomizer->shuffleArray($domain->getWatchlists()->toArray());
/** @var WatchList $watchList */ /** @var Watchlist $watchlist */
foreach ($watchLists as $watchList) { foreach ($watchlists as $watchlist) {
$this->bus->dispatch(new SendDomainEventNotif($watchList->getToken(), $domain->getLdhName(), $updatedAt)); $this->bus->dispatch(new SendDomainEventNotif($watchlist->getToken(), $domain->getLdhName(), $updatedAt));
} }
return $domain; return $domain;

View File

@@ -30,7 +30,7 @@ readonly class ConnectorDeleteProcessor implements ProcessorInterface
*/ */
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): mixed public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): mixed
{ {
foreach ($data->getWatchLists()->getIterator() as $watchlist) { foreach ($data->getWatchlists()->getIterator() as $watchlist) {
$watchlist->setConnector(null); $watchlist->setConnector(null);
} }

View File

@@ -6,7 +6,7 @@ use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProcessorInterface; use ApiPlatform\State\ProcessorInterface;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\User; use App\Entity\User;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Notifier\TestChatNotification; use App\Notifier\TestChatNotification;
use App\Service\ChatNotificationService; use App\Service\ChatNotificationService;
use App\Service\Provider\AbstractProvider; use App\Service\Provider\AbstractProvider;
@@ -19,7 +19,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Serializer\Exception\ExceptionInterface; use Symfony\Component\Serializer\Exception\ExceptionInterface;
readonly class WatchListUpdateProcessor implements ProcessorInterface readonly class WatchlistUpdateProcessor implements ProcessorInterface
{ {
public function __construct( public function __construct(
private Security $security, private Security $security,
@@ -34,9 +34,9 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
} }
/** /**
* @param WatchList $data * @param Watchlist $data
* *
* @return WatchList * @return Watchlist
* *
* @throws ExceptionInterface * @throws ExceptionInterface
* @throws \Exception * @throws \Exception
@@ -57,12 +57,12 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
throw new AccessDeniedHttpException('You have exceeded the maximum number of domain names allowed in this Watchlist'); throw new AccessDeniedHttpException('You have exceeded the maximum number of domain names allowed in this Watchlist');
} }
$userWatchLists = $user->getWatchLists(); $userWatchlists = $user->getWatchlists();
/** @var Domain[] $trackedDomains */ /** @var Domain[] $trackedDomains */
$trackedDomains = $userWatchLists $trackedDomains = $userWatchlists
->filter(fn (WatchList $wl) => $wl->getToken() !== $data->getToken()) ->filter(fn (Watchlist $wl) => $wl->getToken() !== $data->getToken())
->reduce(fn (array $acc, WatchList $wl) => [...$acc, ...$wl->getDomains()->toArray()], []); ->reduce(fn (array $acc, Watchlist $wl) => [...$acc, ...$wl->getDomains()->toArray()], []);
/** @var Domain $domain */ /** @var Domain $domain */
foreach ($data->getDomains()->getIterator() as $domain) { foreach ($data->getDomains()->getIterator() as $domain) {

View File

@@ -3,10 +3,10 @@
namespace App\Tests\Controller; namespace App\Tests\Controller;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase; use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Tests\AuthenticatedUserTrait; use App\Tests\AuthenticatedUserTrait;
use App\Tests\Service\RDAPServiceTest; use App\Tests\Service\RDAPServiceTest;
use App\Tests\State\WatchListUpdateProcessorTest; use App\Tests\State\WatchlistUpdateProcessorTest;
use PHPUnit\Framework\Attributes\DependsExternal; use PHPUnit\Framework\Attributes\DependsExternal;
use Zenstruck\Foundry\Test\Factories; use Zenstruck\Foundry\Test\Factories;
@@ -18,12 +18,12 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')] #[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetWatchlistCollection(): void public function testGetWatchlistCollection(): void
{ {
$client = WatchListUpdateProcessorTest::createUserAndWatchlist(); $client = WatchlistUpdateProcessorTest::createUserAndWatchlist();
$response = $client->request('GET', '/api/watchlists'); $response = $client->request('GET', '/api/watchlists');
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(WatchList::class); $this->assertMatchesResourceCollectionJsonSchema(Watchlist::class);
$data = $response->toArray(); $data = $response->toArray();
$this->assertArrayHasKey('hydra:member', $data); $this->assertArrayHasKey('hydra:member', $data);
@@ -33,7 +33,7 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')] #[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetTrackedDomains() public function testGetTrackedDomains()
{ {
$client = WatchListUpdateProcessorTest::createUserAndWatchlist(null, ['/api/domains/example.org']); $client = WatchlistUpdateProcessorTest::createUserAndWatchlist(null, ['/api/domains/example.org']);
$response = $client->request('GET', '/api/tracked'); $response = $client->request('GET', '/api/tracked');
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
@@ -46,7 +46,7 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')] #[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetWatchlistFeeds() public function testGetWatchlistFeeds()
{ {
$client = WatchListUpdateProcessorTest::createUserAndWatchlist(); $client = WatchlistUpdateProcessorTest::createUserAndWatchlist();
$response = $client->request('GET', '/api/watchlists'); $response = $client->request('GET', '/api/watchlists');
$token = $response->toArray()['hydra:member'][0]['token']; $token = $response->toArray()['hydra:member'][0]['token'];

View File

@@ -6,13 +6,13 @@ use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Config\ConnectorProvider; use App\Config\ConnectorProvider;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\Tld; use App\Entity\Tld;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Factory\UserFactory; use App\Factory\UserFactory;
use App\Message\OrderDomain; use App\Message\OrderDomain;
use App\MessageHandler\OrderDomainHandler; use App\MessageHandler\OrderDomainHandler;
use App\Tests\Controller\ConnectorControllerTest; use App\Tests\Controller\ConnectorControllerTest;
use App\Tests\Service\RDAPServiceTest; use App\Tests\Service\RDAPServiceTest;
use App\Tests\State\WatchListUpdateProcessorTest; use App\Tests\State\WatchlistUpdateProcessorTest;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\Attributes\DependsExternal; use PHPUnit\Framework\Attributes\DependsExternal;
use Symfony\Component\HttpClient\Exception\ServerException; use Symfony\Component\HttpClient\Exception\ServerException;
@@ -89,12 +89,12 @@ class AbstractProviderTest extends ApiTestCase
$entityManager = self::getContainer()->get(EntityManagerInterface::class); $entityManager = self::getContainer()->get(EntityManagerInterface::class);
// Create a Watchlist with the domain name // Create a Watchlist with the domain name
WatchListUpdateProcessorTest::createUserAndWatchlist($client, WatchlistUpdateProcessorTest::createUserAndWatchlist($client,
['/api/domains/example.com'], ['/api/domains/example.com'],
'/api/connectors/'.$response->toArray()['id']); '/api/connectors/'.$response->toArray()['id']);
$response = $client->request('GET', '/api/watchlists'); $response = $client->request('GET', '/api/watchlists');
$watchlist = $entityManager->getRepository(WatchList::class)->findOneBy(['token' => $response->toArray()['hydra:member'][0]['token']]); $watchlist = $entityManager->getRepository(Watchlist::class)->findOneBy(['token' => $response->toArray()['hydra:member'][0]['token']]);
$domain = (new Domain()) $domain = (new Domain())
->setLdhName((new UuidV4()).'.com') ->setLdhName((new UuidV4()).'.com')

View File

@@ -4,14 +4,14 @@ namespace App\Tests\State;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase; use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use ApiPlatform\Symfony\Bundle\Test\Client; use ApiPlatform\Symfony\Bundle\Test\Client;
use App\Entity\WatchList; use App\Entity\Watchlist;
use App\Factory\UserFactory; use App\Factory\UserFactory;
use App\Tests\AuthenticatedUserTrait; use App\Tests\AuthenticatedUserTrait;
use App\Tests\Service\RDAPServiceTest; use App\Tests\Service\RDAPServiceTest;
use PHPUnit\Framework\Attributes\DependsExternal; use PHPUnit\Framework\Attributes\DependsExternal;
use Zenstruck\Foundry\Test\Factories; use Zenstruck\Foundry\Test\Factories;
final class WatchListUpdateProcessorTest extends ApiTestCase final class WatchlistUpdateProcessorTest extends ApiTestCase
{ {
use Factories; use Factories;
use AuthenticatedUserTrait; use AuthenticatedUserTrait;
@@ -22,7 +22,7 @@ final class WatchListUpdateProcessorTest extends ApiTestCase
self::createUserAndWatchlist(); self::createUserAndWatchlist();
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(201); $this->assertResponseStatusCodeSame(201);
$this->assertMatchesResourceItemJsonSchema(WatchList::class); $this->assertMatchesResourceItemJsonSchema(Watchlist::class);
} }
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')] #[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
@@ -48,7 +48,7 @@ final class WatchListUpdateProcessorTest extends ApiTestCase
'trackedEppStatus' => [], 'trackedEppStatus' => [],
]]); ]]);
$this->assertResponseIsSuccessful(); $this->assertResponseIsSuccessful();
$this->assertMatchesResourceItemJsonSchema(WatchList::class); $this->assertMatchesResourceItemJsonSchema(Watchlist::class);
$data = $response->toArray(); $data = $response->toArray();
$this->assertCount(2, $data['domains']); $this->assertCount(2, $data['domains']);
$this->assertCount(1, $data['trackedEvents']); $this->assertCount(1, $data['trackedEvents']);