feat: hello PostgreSQL

This commit is contained in:
Maël Gangloff
2024-07-26 21:10:06 +02:00
parent 467d0efa1c
commit f72f6df546
15 changed files with 142 additions and 437 deletions

View File

@@ -5,11 +5,10 @@ namespace App\Command;
use App\Message\UpdateRdapServers;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface;
#[AsCommand(
@@ -18,7 +17,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
)]
class UpdateRdapServersCommand extends Command
{
public function __construct(private MessageBusInterface $bus)
public function __construct(private readonly MessageBusInterface $bus)
{
parent::__construct();
}
@@ -27,6 +26,9 @@ class UpdateRdapServersCommand extends Command
{
}
/**
* @throws ExceptionInterface
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

View File

@@ -16,6 +16,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
#[ORM\Table(name: "`user`")]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
#[ApiResource(
operations: [

View File

@@ -42,7 +42,7 @@ use Symfony\Component\Uid\Uuid;
class WatchList
{
#[ORM\Id]
#[ORM\Column(length: 36)]
#[ORM\Column(type: 'uuid')]
#[Groups(['watchlist:item', 'watchlist:list'])]
private string $token;

View File

@@ -4,7 +4,6 @@ namespace App\MessageHandler;
use App\Message\UpdateRdapServers;
use App\Service\RDAPService;
use Symfony\Component\Intl\Countries;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;

View File

@@ -129,7 +129,7 @@ readonly class RDAPService
*/
public function registerDomain(string $fqdn): Domain
{
$idnDomain = idn_to_ascii($fqdn);
$idnDomain = strtolower(idn_to_ascii($fqdn));
$tld = $this->getTld($idnDomain);
/** @var RdapServer|null $rdapServer */
@@ -138,7 +138,7 @@ readonly class RDAPService
if ($rdapServer === null) throw new Exception("Unable to determine which RDAP server to contact");
/** @var ?Domain $domain */
$domain = $this->domainRepository->findOneBy(["ldhName" => strtolower($idnDomain)]);
$domain = $this->domainRepository->findOneBy(["ldhName" => $idnDomain]);
try {
@@ -157,7 +157,7 @@ readonly class RDAPService
if ($domain === null) $domain = new Domain();
$domain->setTld($tld)->setLdhName($res['ldhName'])->setDeleted(false);
$domain->setTld($tld)->setLdhName($idnDomain)->setDeleted(false);
if (array_key_exists('status', $res)) $domain->setStatus($res['status']);
if (array_key_exists('handle', $res)) $domain->setHandle($res['handle']);