[backend] accept articles from crawler

This commit is contained in:
2025-10-07 00:15:38 +02:00
parent 327ba5179d
commit 449718cdf2
397 changed files with 1490 additions and 3063 deletions
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Asset;
namespace Basango\SharedKernel\Application\Asset;
/**
* Enum AssetType.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Asset;
namespace Basango\SharedKernel\Application\Asset;
/**
* Class AssetUrlProvider.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Mailing;
namespace Basango\SharedKernel\Application\Mailing;
use App\SharedKernel\Domain\Model\ValueObject\EmailAddress;
use Basango\SharedKernel\Domain\Model\ValueObject\EmailAddress;
/**
* Interface EmailDefinition.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Mailing;
namespace Basango\SharedKernel\Application\Mailing;
/**
* Interface Mailer.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface AsyncMessage.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface CommandBus.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface CommandHandler.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface MessageBus.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface MessageHandler.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface QueryBus.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Application\Messaging;
namespace Basango\SharedKernel\Application\Messaging;
/**
* Interface QueryHandler.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain;
namespace Basango\SharedKernel\Domain;
/**
* Class Application.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain;
namespace Basango\SharedKernel\Domain;
use App\SharedKernel\Domain\Exception\InvalidArgument;
use Basango\SharedKernel\Domain\Exception\InvalidArgument;
/**
* Class Assert.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\DataTransfert;
namespace Basango\SharedKernel\Domain\DataTransfert;
/**
* Interface DataExporter.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\DataTransfert;
namespace Basango\SharedKernel\Domain\DataTransfert;
/**
* Class DataImporter.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\DataTransfert;
namespace Basango\SharedKernel\Domain\DataTransfert;
use App\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Assert;
use BackedEnum as T;
use Symfony\Component\Uid\UuidV7;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\DataTransfert;
namespace Basango\SharedKernel\Domain\DataTransfert;
/**
* Class TransfertSetting.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\EventDispatcher;
namespace Basango\SharedKernel\Domain\EventDispatcher;
/**
* Interface EventDispatcher.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\EventDispatcher;
namespace Basango\SharedKernel\Domain\EventDispatcher;
/**
* Trait EventEmitterTrait.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\EventListener;
namespace Basango\SharedKernel\Domain\EventListener;
/**
* Interface EventListener.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Exception;
namespace Basango\SharedKernel\Domain\Exception;
/**
* Class InvalidArgument.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Exception;
namespace Basango\SharedKernel\Domain\Exception;
/**
* Class InvalidEmailAddress.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Exception;
namespace Basango\SharedKernel\Domain\Exception;
/**
* Interface UserFacingError.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Collection;
namespace Basango\SharedKernel\Domain\Model\Collection;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Collection;
namespace Basango\SharedKernel\Domain\Model\Collection;
use Doctrine\Common\Collections\ArrayCollection as DoctrineArrayCollection;
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Pagination;
namespace Basango\SharedKernel\Domain\Model\Pagination;
use App\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Assert;
/**
* Class Page.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Pagination;
namespace Basango\SharedKernel\Domain\Model\Pagination;
use App\SharedKernel\Domain\DataTransfert\DataMapping;
use Basango\SharedKernel\Domain\DataTransfert\DataMapping;
use Symfony\Component\Uid\UuidV7;
/**
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Pagination;
namespace Basango\SharedKernel\Domain\Model\Pagination;
/**
* Class PaginationInfo.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\Pagination;
namespace Basango\SharedKernel\Domain\Model\Pagination;
/**
* Class PaginatorKeyset.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject;
namespace Basango\SharedKernel\Domain\Model\ValueObject;
use App\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Assert;
use DateTime;
/**
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject;
namespace Basango\SharedKernel\Domain\Model\ValueObject;
use App\SharedKernel\Domain\Assert;
use App\SharedKernel\Domain\Exception\InvalidEmailAddress;
use Basango\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Exception\InvalidEmailAddress;
/**
* Class EmailAddress.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject;
namespace Basango\SharedKernel\Domain\Model\ValueObject;
/**
* Enum SortDirection.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject\Tracking;
namespace Basango\SharedKernel\Domain\Model\ValueObject\Tracking;
/**
* Class ClientProfile.
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject\Tracking;
namespace Basango\SharedKernel\Domain\Model\ValueObject\Tracking;
/**
* Class Device.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Model\ValueObject\Tracking;
namespace Basango\SharedKernel\Domain\Model\ValueObject\Tracking;
use App\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Assert;
/**
* Class GeoLocation.
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace App\SharedKernel\Domain\Tracking;
namespace Basango\SharedKernel\Domain\Tracking;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\ClientProfile;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\Device;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\ClientProfile;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\Device;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation;
/**
* Class ClientProfiler.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\EventDispatcher;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\EventDispatcher;
use App\SharedKernel\Domain\EventDispatcher\EventDispatcher;
use Basango\SharedKernel\Domain\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Logging;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Logging;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\NormalizerFormatter as MonologNormalizerFormatter;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Logging;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Logging;
use Monolog\LogRecord;
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Mailing;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Mailing;
use App\SharedKernel\Application\Mailing\EmailDefinition;
use App\SharedKernel\Application\Mailing\Mailer;
use App\SharedKernel\Domain\Application;
use Basango\SharedKernel\Application\Mailing\EmailDefinition;
use Basango\SharedKernel\Application\Mailing\Mailer;
use Basango\SharedKernel\Domain\Application;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface;
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
use App\SharedKernel\Application\Messaging\CommandBus;
use Basango\SharedKernel\Application\Messaging\CommandBus;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Symfony\Component\Messenger\HandleTrait;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
use App\SharedKernel\Application\Messaging\AsyncMessage;
use App\SharedKernel\Application\Messaging\MessageBus;
use Basango\SharedKernel\Application\Messaging\AsyncMessage;
use Basango\SharedKernel\Application\Messaging\MessageBus;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
namespace Basango\SharedKernel\Infrastructure\Framework\Symfony\Messaging;
use App\SharedKernel\Application\Messaging\QueryBus;
use Basango\SharedKernel\Application\Messaging\QueryBus;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Symfony\Component\Messenger\HandleTrait;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -2,12 +2,12 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL\Features;
namespace Basango\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL\Features;
use App\SharedKernel\Domain\Model\Pagination\Page;
use App\SharedKernel\Domain\Model\Pagination\PaginationCursor;
use App\SharedKernel\Domain\Model\Pagination\PaginationInfo;
use App\SharedKernel\Domain\Model\Pagination\PaginatorKeyset;
use Basango\SharedKernel\Domain\Model\Pagination\Page;
use Basango\SharedKernel\Domain\Model\Pagination\PaginationCursor;
use Basango\SharedKernel\Domain\Model\Pagination\PaginationInfo;
use Basango\SharedKernel\Domain\Model\Pagination\PaginatorKeyset;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL;
namespace Basango\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL;
/**
* Class NoResult.
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL\Types;
namespace Basango\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL\Types;
use App\SharedKernel\Domain\Model\ValueObject\EmailAddress;
use Basango\SharedKernel\Domain\Model\ValueObject\EmailAddress;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Persistence\Filesystem\Asset;
namespace Basango\SharedKernel\Infrastructure\Persistence\Filesystem\Asset;
use App\SharedKernel\Application\Asset\AssetType;
use App\SharedKernel\Application\Asset\AssetUrlProvider as AssetUrlProviderInterface;
use Basango\SharedKernel\Application\Asset\AssetType;
use Basango\SharedKernel\Application\Asset\AssetUrlProvider as AssetUrlProviderInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
/**
@@ -2,12 +2,12 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Persistence\Filesystem;
namespace Basango\SharedKernel\Infrastructure\Persistence\Filesystem;
use App\SharedKernel\Domain\Assert;
use App\SharedKernel\Domain\DataTransfert\DataExporter;
use App\SharedKernel\Domain\DataTransfert\DataImporter;
use App\SharedKernel\Domain\DataTransfert\TransfertSetting;
use Basango\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\DataTransfert\DataExporter;
use Basango\SharedKernel\Domain\DataTransfert\DataImporter;
use Basango\SharedKernel\Domain\DataTransfert\TransfertSetting;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Serializer\SerializerInterface;
@@ -2,13 +2,13 @@
declare(strict_types=1);
namespace App\SharedKernel\Infrastructure\Tracking;
namespace Basango\SharedKernel\Infrastructure\Tracking;
use App\SharedKernel\Domain\Assert;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\ClientProfile;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\Device;
use App\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation;
use App\SharedKernel\Domain\Tracking\ClientProfiler as ClientProfilerInterface;
use Basango\SharedKernel\Domain\Assert;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\ClientProfile;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\Device;
use Basango\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation;
use Basango\SharedKernel\Domain\Tracking\ClientProfiler as ClientProfilerInterface;
use DeviceDetector\ClientHints;
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Client\Browser;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Presentation\Console;
namespace Basango\SharedKernel\Presentation\Console;
use Symfony\Component\Console\Input\InputInterface;
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace App\SharedKernel\Presentation\Web\Controller;
namespace Basango\SharedKernel\Presentation\Web\Controller;
use App\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\SecurityUser;
use App\SharedKernel\Application\Messaging\CommandBus;
use App\SharedKernel\Application\Messaging\QueryBus;
use Basango\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\SecurityUser;
use Basango\SharedKernel\Application\Messaging\CommandBus;
use Basango\SharedKernel\Application\Messaging\QueryBus;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as SymfonyController;
use Symfony\Component\HttpFoundation\Response;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\SharedKernel\Presentation\Web\Controller;
namespace Basango\SharedKernel\Presentation\Web\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
@@ -2,18 +2,19 @@
declare(strict_types=1);
namespace App\SharedKernel\Presentation\Web\EventListener;
namespace Basango\SharedKernel\Presentation\Web\EventListener;
use App\Aggregator\Domain\Exception\ArticleNotFound;
use App\Aggregator\Domain\Exception\SourceNotFound;
use App\FeedManagement\Domain\Exception\BookmarkedArticleNotFound;
use App\FeedManagement\Domain\Exception\BookmarkNotFound;
use App\FeedManagement\Domain\Exception\CommentNotFound;
use App\FeedManagement\Domain\Exception\FollowedSourceNotFound;
use App\IdentityAndAccess\Domain\Exception\PermissionNotGranted;
use App\IdentityAndAccess\Domain\Exception\UserNotFound;
use App\SharedKernel\Domain\Exception\InvalidArgument;
use App\SharedKernel\Domain\Exception\UserFacingError;
use Basango\Aggregator\Domain\Exception\ArticleNotFound;
use Basango\Aggregator\Domain\Exception\DuplicatedArticle;
use Basango\Aggregator\Domain\Exception\SourceNotFound;
use Basango\FeedManagement\Domain\Exception\BookmarkedArticleNotFound;
use Basango\FeedManagement\Domain\Exception\BookmarkNotFound;
use Basango\FeedManagement\Domain\Exception\CommentNotFound;
use Basango\FeedManagement\Domain\Exception\FollowedSourceNotFound;
use Basango\IdentityAndAccess\Domain\Exception\PermissionNotGranted;
use Basango\IdentityAndAccess\Domain\Exception\UserNotFound;
use Basango\SharedKernel\Domain\Exception\InvalidArgument;
use Basango\SharedKernel\Domain\Exception\UserFacingError;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
@@ -47,6 +48,10 @@ final readonly class UserFacingErrorListener
PermissionNotGranted::class,
];
private const array CONFLICT_EXCEPTIONS = [
DuplicatedArticle::class,
];
public function __construct(
private TranslatorInterface $translator
) {
@@ -80,6 +85,7 @@ final readonly class UserFacingErrorListener
in_array($exception::class, self::NOT_FOUND_EXCEPTIONS) => Response::HTTP_NOT_FOUND,
in_array($exception::class, self::BAD_REQUEST_EXCEPTIONS) => Response::HTTP_BAD_REQUEST,
in_array($exception::class, self::FORBIDDEN_EXCEPTIONS) => Response::HTTP_FORBIDDEN,
in_array($exception::class, self::CONFLICT_EXCEPTIONS) => Response::HTTP_CONFLICT,
default => Response::HTTP_UNPROCESSABLE_ENTITY
};
}