mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add PATCH watchlist endpoint
This commit is contained in:
@@ -3,6 +3,7 @@ api_platform:
|
||||
version: 1.0.0
|
||||
formats:
|
||||
jsonld: [ 'application/ld+json' ]
|
||||
xml: [ 'application/xml' ]
|
||||
json: [ 'application/json' ]
|
||||
docs_formats:
|
||||
jsonld: [ 'application/ld+json' ]
|
||||
|
||||
@@ -53,7 +53,6 @@ class WatchListController extends AbstractController
|
||||
$this->em->flush();
|
||||
|
||||
return $watchList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace App\Entity;
|
||||
|
||||
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 App\Repository\WatchListRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -28,7 +30,12 @@ use Symfony\Component\Uid\Uuid;
|
||||
routeName: 'watchlist_create', normalizationContext: ['groups' => 'watchlist:list'],
|
||||
denormalizationContext: ['groups' => 'watchlist:create'],
|
||||
name: 'create'
|
||||
)
|
||||
),
|
||||
new Patch(
|
||||
normalizationContext: ['groups' => 'watchlist:item'],
|
||||
denormalizationContext: ['groups' => 'watchlist:update']
|
||||
),
|
||||
new Delete()
|
||||
],
|
||||
)]
|
||||
class WatchList
|
||||
@@ -49,7 +56,7 @@ class WatchList
|
||||
#[ORM\JoinTable(name: 'watch_lists_domains',
|
||||
joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token')],
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name')])]
|
||||
#[Groups(['watchlist:item', 'watchlist:create'])]
|
||||
#[Groups(['watchlist:item', 'watchlist:create', 'watchlist:update'])]
|
||||
private Collection $domains;
|
||||
|
||||
public function __construct()
|
||||
|
||||
Reference in New Issue
Block a user