From e8189a4d0463ae3dd571680bf4b9a50ab23e94f2 Mon Sep 17 00:00:00 2001 From: Matteo Date: Tue, 3 Feb 2026 17:32:39 +0100 Subject: [PATCH] =?UTF-8?q?feat=20:=20mise=20=C3=A0=20jour=20du=20bon=20de?= =?UTF-8?q?=20r=C3=A9ception=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 35 +++++++++++++++++---------- src/Entity/BovinShipment.php | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 12 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dd56244..3fa597c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,15 +4,10 @@ - - @@ -742,7 +751,9 @@ - diff --git a/src/Entity/BovinShipment.php b/src/Entity/BovinShipment.php index 7d261a0..bf4b7c4 100644 --- a/src/Entity/BovinShipment.php +++ b/src/Entity/BovinShipment.php @@ -4,10 +4,56 @@ declare(strict_types=1); namespace App\Entity; +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\Get; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\Patch; +use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity] #[ORM\Table(name: 'bovin_shipment')] +#[ApiResource( + operations: [ + new Get( + requirements: ['id' => '\d+'], + normalizationContext: ['groups' => ['bovin-shipment:read']], + ), + new GetCollection( + normalizationContext: ['groups' => ['bovin-shipment:read']], + ), + new Post( + normalizationContext: ['groups' => ['bovin-shipment:read']], + denormalizationContext: ['groups' => ['bovin-shipment:write']], + ), + new Patch( + requirements: ['id' => '\d+'], + normalizationContext: ['groups' => ['bovin-shipment:read']], + denormalizationContext: ['groups' => ['bovin-shipment:write']], + ), + // new Get( + // uriTemplate: '/receptions/weigh', + // openapi: new OpenApiOperation( + // summary: 'Fetch the current weight reading', + // description: 'Queries the pont-bascule and returns the weight data.', + // ), + // normalizationContext: ['groups' => ['reception:weigh:read']], + // output: PontBasculeReading::class, + // provider: ReceptionWeighingProvider::class, + // ), + // new Get( + // uriTemplate: '/receptions/{id}/receipt', + // requirements: ['id' => '\d+'], + // openapi: new OpenApiOperation( + // summary: 'Render a reception receipt', + // description: 'Returns a PDF receipt for the reception.', + // ), + // output: false, + // provider: ReceptionReceiptProvider::class, + // ), + ], +)] class BovinShipment { #[ORM\Id]