mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Show lots, order and pricedetails in part response
This commit is contained in:
parent
43c15de55c
commit
59f62d4a4c
6 changed files with 10 additions and 10 deletions
|
@ -71,13 +71,13 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
#[ORM\Index(name: 'parts_idx_ipn', columns: ['ipn'])]
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(security: 'is_granted("read", object)'),
|
||||
new Get(normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read', 'part_lot:read', 'orderdetail:read', 'pricedetail: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)'),
|
||||
new Delete(security: 'is_granted("delete", object)'),
|
||||
],
|
||||
normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||
normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read', 'part_lot:read'], 'openapi_definition_name' => 'Read'],
|
||||
denormalizationContext: ['groups' => ['part:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
|
|
|
@ -66,7 +66,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
new Patch(security: 'is_granted("edit", object)'),
|
||||
new Delete(security: 'is_granted("delete", object)'),
|
||||
],
|
||||
normalizationContext: ['groups' => ['part_lot:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||
normalizationContext: ['groups' => ['part_lot:read', 'part_lot:read:standalone', 'api:basic:read', 'pricedetail:read'], 'openapi_definition_name' => 'Read'],
|
||||
denormalizationContext: ['groups' => ['part_lot:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
|
@ -133,7 +133,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'partLots')]
|
||||
#[ORM\JoinColumn(name: 'id_part', nullable: false, onDelete: 'CASCADE')]
|
||||
#[Groups(['part_lot:read', 'part_lot:write'])]
|
||||
#[Groups(['part_lot:read:standalone', 'part_lot:write'])]
|
||||
protected ?Part $part = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ trait InstockTrait
|
|||
* @var Collection<int, PartLot> A list of part lots where this part is stored
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[Groups(['extended', 'full', 'import', 'part:read', 'part:write'])]
|
||||
#[ORM\OneToMany(targetEntity: PartLot::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['amount' => 'DESC'])]
|
||||
protected Collection $partLots;
|
||||
|
|
|
@ -39,7 +39,7 @@ trait OrderTrait
|
|||
* @var Collection<int, Orderdetail> The details about how and where you can order this part
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[Groups(['extended', 'full', 'import', 'part:read', 'part:write'])]
|
||||
#[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['supplierpartnr' => 'ASC'])]
|
||||
protected Collection $orderdetails;
|
||||
|
|
|
@ -63,7 +63,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
new Patch(security: 'is_granted("edit", object)'),
|
||||
new Delete(security: 'is_granted("delete", object)'),
|
||||
],
|
||||
normalizationContext: ['groups' => ['orderdetail:read', 'api:basic:read', 'pricedetail:read'], 'openapi_definition_name' => 'Read'],
|
||||
normalizationContext: ['groups' => ['orderdetail:read', 'orderdetail:read:standalone', 'api:basic:read', 'pricedetail:read'], 'openapi_definition_name' => 'Read'],
|
||||
denormalizationContext: ['groups' => ['orderdetail:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||
)]
|
||||
#[ApiResource(
|
||||
|
@ -115,7 +115,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
*/
|
||||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'orderdetails')]
|
||||
#[Groups(['orderdetail:read', 'orderdetail:write'])]
|
||||
#[Groups(['orderdetail:read:standalone', 'orderdetail:write'])]
|
||||
#[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?Part $part = null;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
new Patch(security: 'is_granted("edit", object)'),
|
||||
new Delete(security: 'is_granted("delete", object)'),
|
||||
],
|
||||
normalizationContext: ['groups' => ['pricedetail:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||
normalizationContext: ['groups' => ['pricedetail:read', 'pricedetail:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||
denormalizationContext: ['groups' => ['pricedetail:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
|
@ -117,7 +117,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: Orderdetail::class, inversedBy: 'pricedetails')]
|
||||
#[ORM\JoinColumn(name: 'orderdetails_id', nullable: false, onDelete: 'CASCADE')]
|
||||
#[Groups(['pricedetail:read', 'pricedetail:write'])]
|
||||
#[Groups(['pricedetail:read:standalone', 'pricedetail:write'])]
|
||||
protected ?Orderdetail $orderdetail = null;
|
||||
|
||||
public function __construct()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue