feat(api): add watchlist calendar

This commit is contained in:
Maël Gangloff
2024-08-01 14:37:23 +02:00
parent f04899fd8e
commit 7a46299dd4
3 changed files with 110 additions and 79 deletions

View File

@@ -8,6 +8,7 @@ use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use App\Controller\WatchListController;
use App\Repository\WatchListRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -28,6 +29,29 @@ use Symfony\Component\Uid\Uuid;
new Get(
normalizationContext: ['groups' => 'watchlist:item']
),
new Get(
routeName: 'watchlist_calendar',
controller: WatchListController::class,
openapiContext: [
'responses' => [
'200' => [
'description' => 'Watchlist iCalendar',
'content' => [
'text/calendar' => [
'schema' => [
'type' => 'string',
'format' => 'text'
]
]
]
]
]
],
read: false,
deserialize: false,
serialize: false,
name: 'calendar'
),
new Post(
routeName: 'watchlist_create', normalizationContext: ['groups' => 'watchlist:list'],
denormalizationContext: ['groups' => 'watchlist:create'],