Allow to filter attachments API response by attachment types

This commit is contained in:
Jan Böhmer 2023-10-03 23:58:41 +02:00
parent 0e75d76720
commit e09f60e71f
2 changed files with 2 additions and 0 deletions

View file

View file

@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use App\ApiPlatform\DocumentedAPIProperty;
use App\ApiPlatform\Filter\EntityFilter;
use App\ApiPlatform\Filter\LikeFilter;
use App\Repository\AttachmentRepository;
use App\EntityListeners\AttachmentDeleteListener;
@ -84,6 +85,7 @@ use LogicException;
#[DocumentedAPIProperty(schemaName: 'Attachment-Read', property: 'thumbnail_url', type: 'string', nullable: true,
description: 'The URL to a thumbnail version of this file. This only exists for internal picture attachments.')]
#[ApiFilter(LikeFilter::class, properties: ["name"])]
#[ApiFilter(EntityFilter::class, properties: ["attachment_type"])]
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
#[ApiFilter(OrderFilter::class, properties: ['name', 'id', 'addedDate', 'lastModified'])]
abstract class Attachment extends AbstractNamedDBElement