mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added endpoint for storage locations
This commit is contained in:
parent
3738cb6025
commit
4e57750214
1 changed files with 14 additions and 3 deletions
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
use ApiPlatform\Metadata\ApiFilter;
|
use ApiPlatform\Metadata\ApiFilter;
|
||||||
|
use ApiPlatform\Metadata\ApiProperty;
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use ApiPlatform\Metadata\Delete;
|
use ApiPlatform\Metadata\Delete;
|
||||||
use ApiPlatform\Metadata\Get;
|
use ApiPlatform\Metadata\Get;
|
||||||
|
@ -84,13 +85,19 @@ class StorageLocation extends AbstractPartsContainingDBElement
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
|
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
|
||||||
#[ORM\JoinColumn(name: 'parent_id')]
|
#[ORM\JoinColumn(name: 'parent_id')]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
|
#[ApiProperty(readableLink: false, writableLink: false)]
|
||||||
protected ?AbstractStructuralDBElement $parent = null;
|
protected ?AbstractStructuralDBElement $parent = null;
|
||||||
|
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
|
protected string $comment = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
|
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class)]
|
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class)]
|
||||||
#[ORM\JoinColumn(name: 'storage_type_id')]
|
#[ORM\JoinColumn(name: 'storage_type_id')]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
protected ?MeasurementUnit $storage_type = null;
|
protected ?MeasurementUnit $storage_type = null;
|
||||||
|
|
||||||
/** @var Collection<int, StorageLocationParameter>
|
/** @var Collection<int, StorageLocationParameter>
|
||||||
|
@ -103,21 +110,21 @@ class StorageLocation extends AbstractPartsContainingDBElement
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
#[Groups(['full', 'import'])]
|
#[Groups(['full', 'import', 'location:read', 'location:write'])]
|
||||||
#[ORM\Column(type: Types::BOOLEAN)]
|
#[ORM\Column(type: Types::BOOLEAN)]
|
||||||
protected bool $is_full = false;
|
protected bool $is_full = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
#[Groups(['full', 'import'])]
|
#[Groups(['full', 'import', 'location:read', 'location:write'])]
|
||||||
#[ORM\Column(type: Types::BOOLEAN)]
|
#[ORM\Column(type: Types::BOOLEAN)]
|
||||||
protected bool $only_single_part = false;
|
protected bool $only_single_part = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
#[Groups(['full', 'import'])]
|
#[Groups(['full', 'import', 'location:read', 'location:write'])]
|
||||||
#[ORM\Column(type: Types::BOOLEAN)]
|
#[ORM\Column(type: Types::BOOLEAN)]
|
||||||
protected bool $limit_to_existing_parts = false;
|
protected bool $limit_to_existing_parts = false;
|
||||||
|
|
||||||
|
@ -127,12 +134,14 @@ class StorageLocation extends AbstractPartsContainingDBElement
|
||||||
#[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')]
|
#[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')]
|
||||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||||
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
|
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
protected ?User $owner = null;
|
protected ?User $owner = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
|
* @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
|
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
protected bool $part_owner_must_match = false;
|
protected bool $part_owner_must_match = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,10 +149,12 @@ class StorageLocation extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
#[Assert\Valid]
|
#[Assert\Valid]
|
||||||
#[ORM\OneToMany(targetEntity: StorageLocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
#[ORM\OneToMany(targetEntity: StorageLocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
protected Collection $attachments;
|
protected Collection $attachments;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: StorageLocationAttachment::class)]
|
#[ORM\ManyToOne(targetEntity: StorageLocationAttachment::class)]
|
||||||
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
|
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
|
||||||
|
#[Groups(['location:read', 'location:write'])]
|
||||||
protected ?Attachment $master_picture_attachment = null;
|
protected ?Attachment $master_picture_attachment = null;
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue