fix : correction des retours de la V0
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

This commit is contained in:
2026-03-18 14:47:03 +01:00
parent 995e7de2cc
commit a905c6a1de
64 changed files with 1979 additions and 1640 deletions

View File

@@ -8,6 +8,7 @@ use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
@@ -47,6 +48,9 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
normalizationContext: ['groups' => ['shipment:read']],
denormalizationContext: ['groups' => ['shipment:write']],
),
new Delete(
requirements: ['id' => '\d+'],
),
new Get(
uriTemplate: '/shipments/weigh',
openapi: new OpenApiOperation(
@@ -102,7 +106,10 @@ class Shipment
#[ORM\Column(name: 'shipment_date', type: 'datetime_immutable')]
#[Groups(['shipment:read', 'shipment:write'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
#[Context(
normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i'],
denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'],
)]
private ?DateTimeImmutable $shipmentDate = null;
#[ORM\ManyToOne]
@@ -245,6 +252,13 @@ class Shipment
public function setShipmentDate(?DateTimeImmutable $shipmentDate): void
{
if (null !== $shipmentDate && null !== $this->shipmentDate) {
$shipmentDate = $shipmentDate->setTime(
(int) $this->shipmentDate->format('H'),
(int) $this->shipmentDate->format('i'),
(int) $this->shipmentDate->format('s'),
);
}
$this->shipmentDate = $shipmentDate;
}
@@ -303,6 +317,21 @@ class Shipment
}
}
#[ORM\PrePersist]
public function initializeShipmentDate(): void
{
$now = new DateTimeImmutable();
if (null === $this->shipmentDate) {
$this->shipmentDate = $now;
} else {
$this->shipmentDate = $this->shipmentDate->setTime(
(int) $now->format('H'),
(int) $now->format('i'),
(int) $now->format('s'),
);
}
}
#[ORM\PostPersist]
public function initializeIdentificationNumber(PostPersistEventArgs $args): void
{