Added missing lastModified and creationDate fields to API response

This commit is contained in:
Jan Böhmer 2023-10-04 00:08:10 +02:00
parent e09f60e71f
commit 64c38042a0
9 changed files with 56 additions and 4 deletions

View file

@ -156,6 +156,12 @@ abstract class Attachment extends AbstractNamedDBElement
#[Groups(['attachment:read', 'attachment_write'])]
protected ?AttachmentType $attachment_type = null;
#[Groups(['attachment:read'])]
protected ?\DateTimeInterface $addedDate = null;
#[Groups(['attachment:read'])]
protected ?\DateTimeInterface $lastModified = null;
public function __construct()
{
//parent::__construct();

View file

@ -76,7 +76,7 @@ use Symfony\Component\Validator\Constraints as Assert;
uriVariables: [
'id' => new Link(fromProperty: 'children', fromClass: AttachmentType::class)
],
normalizationContext: ['groups' => ['footprint:read', 'api:basic:read'], 'openapi_definition_name' => 'Read']
normalizationContext: ['groups' => ['attachment_type:read', 'api:basic:read'], 'openapi_definition_name' => 'Read']
)]
#[ApiFilter(PropertyFilter::class)]
#[ApiFilter(LikeFilter::class, properties: ["name", "comment"])]
@ -96,7 +96,7 @@ class AttachmentType extends AbstractStructuralDBElement
/**
* @var string A comma separated list of file types, which are allowed for attachment files.
* Must be in the format of <input type=file> accept attribute
* Must be in the format of <pre><input type=file></pre> accept attribute
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
*/
#[ORM\Column(type: Types::TEXT)]
@ -132,6 +132,12 @@ class AttachmentType extends AbstractStructuralDBElement
#[ORM\OneToMany(targetEntity: Attachment::class, mappedBy: 'attachment_type')]
protected Collection $attachments_with_type;
#[Groups(['attachment_type:read'])]
protected ?\DateTimeInterface $addedDate = null;
#[Groups(['attachment_type:read'])]
protected ?\DateTimeInterface $lastModified = null;
public function __construct()
{
$this->children = new ArrayCollection();