mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add domain register endpoint
This commit is contained in:
19
src/Controller/DomainRefreshController.php
Normal file
19
src/Controller/DomainRefreshController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Service\RDAPService;
|
||||
use Exception;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class DomainRefreshController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __invoke(string $ldhName, RDAPService $RDAPService): void
|
||||
{
|
||||
$RDAPService->registerDomains([$ldhName]);
|
||||
}
|
||||
}
|
||||
@@ -28,24 +28,12 @@ class TestController extends AbstractController
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private readonly RDAPService $RDAPService,
|
||||
private readonly DomainRepository $domainRepository
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#[Route(path: '/test/register', name: 'test_register_domain')]
|
||||
public function testRegisterDomain(Request $request): Response
|
||||
{
|
||||
try {
|
||||
$this->RDAPService->registerDomains(explode(',', $request->query->get('domains')));
|
||||
} catch (Exception $e) {
|
||||
return new Response($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
return new Response();
|
||||
}
|
||||
|
||||
#[Route(path: '/test/publish/calendar', name: 'test_publish_calendar')]
|
||||
public function testPublishCalendar(): Response
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user