style: lint

This commit is contained in:
Vincent 2025-05-30 13:31:16 +02:00
parent eed454c6bc
commit f447489718
No known key found for this signature in database
GPG Key ID: 056662E78D70E358
6 changed files with 28 additions and 66 deletions

View File

@ -7,7 +7,8 @@ import type {Connector} from '../../../utils/api/connectors'
import {rdapEventDetailTranslation, rdapEventNameTranslation} from '../../../utils/functions/rdapTranslation' import {rdapEventDetailTranslation, rdapEventNameTranslation} from '../../../utils/functions/rdapTranslation'
import {actionToColor} from '../../../utils/functions/actionToColor' import {actionToColor} from '../../../utils/functions/actionToColor'
import {actionToIcon} from '../../../utils/functions/actionToIcon' import {actionToIcon} from '../../../utils/functions/actionToIcon'
import {EventAction, createWatchlistTrigger, Watchlist, deleteWatchlistTrigger} from '../../../utils/api' import type {EventAction, Watchlist} from '../../../utils/api'
import { createWatchlistTrigger, deleteWatchlistTrigger} from '../../../utils/api'
import {formItemLayoutWithOutLabel} from "../../../utils/providers" import {formItemLayoutWithOutLabel} from "../../../utils/providers"
type TagRender = SelectProps['tagRender'] type TagRender = SelectProps['tagRender']
@ -60,41 +61,41 @@ export function WatchlistForm({form, connectors, onFinish, isCreation, watchList
) )
} }
const [triggersLoading, setTriggersLoading] = useState(false); const [triggersLoading, setTriggersLoading] = useState(false)
const createTrigger = async (event: string) => { const createTrigger = async (event: string) => {
if (isCreation) return if (isCreation) return
setTriggersLoading(true); setTriggersLoading(true)
await createWatchlistTrigger(watchList!.token, { // FIXME this 500s await createWatchlistTrigger(watchList!.token, { // FIXME this 500s
watchList: watchList!['@id'], watchList: watchList!['@id'],
event, event,
action: 'email', action: 'email',
}); })
await createWatchlistTrigger(watchList!.token, { await createWatchlistTrigger(watchList!.token, {
watchList: watchList!['@id'], watchList: watchList!['@id'],
event, event,
action: 'chat', action: 'chat',
}); })
setTriggersLoading(false); setTriggersLoading(false)
}; }
const removeTrigger = async (event: string) => { const removeTrigger = async (event: string) => {
if (isCreation) return if (isCreation) return
setTriggersLoading(true); setTriggersLoading(true)
await deleteWatchlistTrigger(watchList!.token, { await deleteWatchlistTrigger(watchList!.token, {
watchList: watchList!['@id'], watchList: watchList!['@id'],
event, event,
action: 'email', action: 'email',
}); })
await deleteWatchlistTrigger(watchList!.token, { await deleteWatchlistTrigger(watchList!.token, {
watchList: watchList!['@id'], watchList: watchList!['@id'],
event, event,
action: 'chat', action: 'chat',
}); })
setTriggersLoading(false); setTriggersLoading(false)
}; }
return ( return (
<Form <Form

View File

@ -62,8 +62,8 @@ export async function createWatchlistTrigger(watchListToken: string, watchListTr
method: 'POST', method: 'POST',
url: `watchlist-triggers`, url: `watchlist-triggers`,
data: watchListTrigger, data: watchListTrigger,
}); })
return response.data; return response.data
} }
export async function deleteWatchlistTrigger(watchListToken: string, watchListTrigger: WatchlistTrigger): Promise<void> { export async function deleteWatchlistTrigger(watchListToken: string, watchListTrigger: WatchlistTrigger): Promise<void> {
@ -71,5 +71,5 @@ export async function deleteWatchlistTrigger(watchListToken: string, watchListTr
method: 'DELETE', method: 'DELETE',
url: `watchlists/${watchListToken}/triggers/${watchListTrigger.action}/${watchListTrigger.event}`, url: `watchlists/${watchListToken}/triggers/${watchListTrigger.action}/${watchListTrigger.event}`,
data: watchListTrigger data: watchListTrigger
}); })
} }

View File

@ -2,23 +2,13 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Connector;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\DomainEntity; use App\Entity\DomainEntity;
use App\Entity\DomainEvent; use App\Entity\DomainEvent;
use App\Entity\User; use App\Entity\User;
use App\Entity\WatchList; use App\Entity\WatchList;
use App\Notifier\TestChatNotification;
use App\Repository\DomainRepository;
use App\Repository\WatchListRepository; use App\Repository\WatchListRepository;
use App\Service\ChatNotificationService;
use App\Service\Connector\AbstractProvider;
use App\Service\RDAPService;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Exception\ORMException;
use Doctrine\ORM\OptimisticLockException;
use Eluceo\iCal\Domain\Entity\Attendee; use Eluceo\iCal\Domain\Entity\Attendee;
use Eluceo\iCal\Domain\Entity\Calendar; use Eluceo\iCal\Domain\Entity\Calendar;
use Eluceo\iCal\Domain\Entity\Event; use Eluceo\iCal\Domain\Entity\Event;
@ -31,31 +21,13 @@ use Eluceo\iCal\Domain\ValueObject\Timestamp;
use Eluceo\iCal\Presentation\Component\Property; use Eluceo\iCal\Presentation\Component\Property;
use Eluceo\iCal\Presentation\Component\Property\Value\TextValue; use Eluceo\iCal\Presentation\Component\Property\Value\TextValue;
use Eluceo\iCal\Presentation\Factory\CalendarFactory; use Eluceo\iCal\Presentation\Factory\CalendarFactory;
use Psr\Log\LoggerInterface;
use Sabre\VObject\EofException; use Sabre\VObject\EofException;
use Sabre\VObject\InvalidDataException; use Sabre\VObject\InvalidDataException;
use Sabre\VObject\ParseException; use Sabre\VObject\ParseException;
use Sabre\VObject\Reader; use Sabre\VObject\Reader;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\RateLimiter\RateLimiterFactory;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Exception\ExceptionInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
class WatchListController extends AbstractController class WatchListController extends AbstractController
{ {

View File

@ -2,12 +2,10 @@
namespace App\Entity; namespace App\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete; use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put; use ApiPlatform\Metadata\Put;
use App\Repository\WatchListRepository; use App\Repository\WatchListRepository;
@ -31,7 +29,7 @@ use Symfony\Component\Uid\Uuid;
'watchlist:list', 'watchlist:list',
'domain:list', 'domain:list',
'event:list', 'event:list',
] ],
], ],
name: 'get_all_mine', name: 'get_all_mine',
), ),
@ -45,7 +43,7 @@ use Symfony\Component\Uid\Uuid;
'event:list', 'event:list',
'domain:list', 'domain:list',
'event:list', 'event:list',
] ],
], ],
name: 'get_tracked_domains' name: 'get_tracked_domains'
), ),

View File

@ -8,7 +8,6 @@ use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Link;
use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Config\TriggerAction; use App\Config\TriggerAction;
use App\Repository\EventTriggerRepository; use App\Repository\EventTriggerRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;

View File

@ -3,11 +3,10 @@
namespace App\State; namespace App\State;
use ApiPlatform\Metadata\Operation; use ApiPlatform\Metadata\Operation;
use ApiPlatform\Metadata\Post;
use ApiPlatform\State\ProcessorInterface; use ApiPlatform\State\ProcessorInterface;
use App\Entity\Domain; use App\Entity\Domain;
use App\Entity\User;
use App\Entity\WatchList; use App\Entity\WatchList;
use App\Entity\WatchListTrigger;
use App\Notifier\TestChatNotification; use App\Notifier\TestChatNotification;
use App\Repository\DomainRepository; use App\Repository\DomainRepository;
use App\Service\ChatNotificationService; use App\Service\ChatNotificationService;
@ -21,18 +20,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\RateLimiter\RateLimiterFactory; use Symfony\Component\RateLimiter\RateLimiterFactory;
class WatchListUpdateProcessor implements ProcessorInterface class WatchListUpdateProcessor implements ProcessorInterface
{ {
public function __construct( public function __construct(
private readonly DomainRepository $domainRepository,
private readonly RDAPService $RDAPService,
private readonly KernelInterface $kernel,
private readonly Security $security, private readonly Security $security,
private readonly RateLimiterFactory $rdapRequestsLimiter,
private readonly ParameterBagInterface $parameterBag, private readonly ParameterBagInterface $parameterBag,
#[Autowire(service: 'api_platform.doctrine.orm.state.persist_processor')] #[Autowire(service: 'api_platform.doctrine.orm.state.persist_processor')]
private readonly ProcessorInterface $persistProcessor, private readonly ProcessorInterface $persistProcessor,
@ -40,19 +34,17 @@ class WatchListUpdateProcessor implements ProcessorInterface
private readonly ChatNotificationService $chatNotificationService, private readonly ChatNotificationService $chatNotificationService,
#[Autowire(service: 'service_container')] #[Autowire(service: 'service_container')]
private readonly ContainerInterface $locator, private readonly ContainerInterface $locator,
private readonly EntityManagerInterface $entityManager, ) {
) }
{}
/** /**
* @param WatchList $data * @param WatchList $data
* @param Operation $operation *
* @param array $uriVariables
* @param array $context
* @return WatchList * @return WatchList
*/ */
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): mixed public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): mixed
{ {
/** @var User $user */
$user = $this->security->getUser(); $user = $this->security->getUser();
$data->setUser($user); $data->setUser($user);