feat(bookstack) : add BookStackLink API resource with CRUD operations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
58
src/ApiResource/BookStackLink.php
Normal file
58
src/ApiResource/BookStackLink.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\State\BookStackLinkProcessor;
|
||||
use App\State\BookStackLinkProvider;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new GetCollection(
|
||||
uriTemplate: '/tasks/{taskId}/bookstack/links',
|
||||
normalizationContext: ['groups' => ['bookstack_link:read']],
|
||||
provider: BookStackLinkProvider::class,
|
||||
security: "is_granted('IS_AUTHENTICATED_FULLY')",
|
||||
),
|
||||
new Post(
|
||||
uriTemplate: '/tasks/{taskId}/bookstack/links',
|
||||
denormalizationContext: ['groups' => ['bookstack_link:write']],
|
||||
normalizationContext: ['groups' => ['bookstack_link:read']],
|
||||
provider: BookStackLinkProvider::class,
|
||||
processor: BookStackLinkProcessor::class,
|
||||
security: "is_granted('IS_AUTHENTICATED_FULLY')",
|
||||
),
|
||||
new Delete(
|
||||
uriTemplate: '/tasks/{taskId}/bookstack/links/{id}',
|
||||
provider: BookStackLinkProvider::class,
|
||||
processor: BookStackLinkProcessor::class,
|
||||
security: "is_granted('IS_AUTHENTICATED_FULLY')",
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class BookStackLink
|
||||
{
|
||||
#[Groups(['bookstack_link:read'])]
|
||||
public ?int $id = null;
|
||||
|
||||
#[Groups(['bookstack_link:read', 'bookstack_link:write'])]
|
||||
public int $bookstackId = 0;
|
||||
|
||||
#[Groups(['bookstack_link:read', 'bookstack_link:write'])]
|
||||
public string $bookstackType = '';
|
||||
|
||||
#[Groups(['bookstack_link:read', 'bookstack_link:write'])]
|
||||
public string $title = '';
|
||||
|
||||
#[Groups(['bookstack_link:read', 'bookstack_link:write'])]
|
||||
public string $url = '';
|
||||
|
||||
#[Groups(['bookstack_link:read'])]
|
||||
public ?string $createdAt = null;
|
||||
}
|
||||
Reference in New Issue
Block a user