mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Allow to view and edit parameters of elements
This commit is contained in:
parent
78a6262665
commit
f285061a76
8 changed files with 39 additions and 11 deletions
|
@ -165,7 +165,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
/** @var Collection<int, CategoryParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full', 'category:read'])]
|
||||
#[Groups(['full', 'category:read', 'category:write'])]
|
||||
#[ORM\OneToMany(targetEntity: CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
|
|
@ -119,7 +119,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
#[Groups(['footprint:read'])]
|
||||
#[Groups(['footprint:read', 'footprint:write'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/****************************************
|
||||
|
|
|
@ -141,7 +141,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
#[Groups(['measurement_unit:read'])]
|
||||
#[Groups(['measurement_unit:read', 'measurement_unit:write'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,7 +73,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read', 'part_lot:read',
|
||||
'orderdetail:read', 'pricedetail:read', 'attachment:read']], security: 'is_granted("read", object)'),
|
||||
'orderdetail:read', 'pricedetail:read', 'parameter:read', 'attachment:read'],
|
||||
'openapi_definition_name' => 'Read',
|
||||
], security: 'is_granted("read", object)'),
|
||||
new GetCollection(security: 'is_granted("@parts.read")'),
|
||||
new Post(securityPostDenormalize: 'is_granted("create", object)'),
|
||||
new Patch(security: 'is_granted("edit", object)'),
|
||||
|
@ -97,7 +99,7 @@ class Part extends AttachmentContainingDBElement
|
|||
/** @var Collection<int, PartParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
#[Groups(['full', 'part:read', 'part:write'])]
|
||||
#[ORM\OneToMany(targetEntity: PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
|
|
@ -105,6 +105,7 @@ class StorageLocation extends AbstractPartsContainingDBElement
|
|||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: StorageLocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
#[Groups(['location:read', 'location:write'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue