mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Added documentation for virtual fields of Attachment and Part entity
This commit is contained in:
parent
607bb45f5f
commit
7bd44484be
2 changed files with 9 additions and 0 deletions
|
@ -29,6 +29,7 @@ use ApiPlatform\Metadata\Get;
|
||||||
use ApiPlatform\Metadata\GetCollection;
|
use ApiPlatform\Metadata\GetCollection;
|
||||||
use ApiPlatform\Metadata\Patch;
|
use ApiPlatform\Metadata\Patch;
|
||||||
use ApiPlatform\Metadata\Post;
|
use ApiPlatform\Metadata\Post;
|
||||||
|
use App\ApiPlatform\DocumentedAPIProperty;
|
||||||
use App\Repository\AttachmentRepository;
|
use App\Repository\AttachmentRepository;
|
||||||
use App\EntityListeners\AttachmentDeleteListener;
|
use App\EntityListeners\AttachmentDeleteListener;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
@ -73,6 +74,11 @@ use LogicException;
|
||||||
normalizationContext: ['groups' => ['attachment:read', 'attachment:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
normalizationContext: ['groups' => ['attachment:read', 'attachment:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||||
denormalizationContext: ['groups' => ['attachment:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
denormalizationContext: ['groups' => ['attachment:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||||
)]
|
)]
|
||||||
|
#[DocumentedAPIProperty(schemaName: 'Attachment-Read', property: 'media_url', type: 'string', nullable: true,
|
||||||
|
description: 'The URL to the file, where the attachment file can be downloaded. This can be an internal or external URL.',
|
||||||
|
example: '/media/part/2/bc547-6508afa5a79c8.pdf')]
|
||||||
|
#[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.')]
|
||||||
abstract class Attachment extends AbstractNamedDBElement
|
abstract class Attachment extends AbstractNamedDBElement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,6 +32,7 @@ use ApiPlatform\Metadata\Link;
|
||||||
use ApiPlatform\Metadata\Patch;
|
use ApiPlatform\Metadata\Patch;
|
||||||
use ApiPlatform\Metadata\Post;
|
use ApiPlatform\Metadata\Post;
|
||||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||||
|
use App\ApiPlatform\DocumentedAPIProperty;
|
||||||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||||
use App\Repository\PartRepository;
|
use App\Repository\PartRepository;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
@ -85,6 +86,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
denormalizationContext: ['groups' => ['part:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
denormalizationContext: ['groups' => ['part:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||||
)]
|
)]
|
||||||
#[ApiFilter(PropertyFilter::class)]
|
#[ApiFilter(PropertyFilter::class)]
|
||||||
|
#[DocumentedAPIProperty(schemaName: 'Part-Read', property: 'total_instock', type: 'number', nullable: false,
|
||||||
|
description: 'The total amount of this part in stock (sum of all part lots).')]
|
||||||
class Part extends AttachmentContainingDBElement
|
class Part extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
use AdvancedPropertyTrait;
|
use AdvancedPropertyTrait;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue