wip: refactor watchlist triggers

This commit is contained in:
Vincent
2025-05-22 14:00:17 +02:00
parent a9ed531921
commit 130ce1bbac
9 changed files with 108 additions and 33 deletions

View File

@@ -2,10 +2,12 @@
namespace App\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Repository\WatchListRepository;
@@ -90,6 +92,7 @@ use Symfony\Component\Uid\Uuid;
security: 'object.user == user',
name: 'update',
processor: WatchListUpdateProcessor::class,
extraProperties: ['standard_put' => false],
),
new Delete(
security: 'object.user == user'
@@ -101,10 +104,12 @@ class WatchList
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchLists')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
public ?User $user = null;
#[ORM\Id]
#[ORM\Column(type: 'uuid')]
#[Groups(['watchlist:item', 'watchlist:list', 'watchlist:token'])]
private string $token;
/**
* @var Collection<int, Domain>
*/