diff --git a/src/Resources/Product.php b/src/Resources/Product.php index da4f34e..c5e4ef6 100644 --- a/src/Resources/Product.php +++ b/src/Resources/Product.php @@ -7,6 +7,7 @@ use MorningTrain\Economic\Attributes\Resources\GetCollection; use MorningTrain\Economic\Attributes\Resources\GetSingle; use MorningTrain\Economic\Attributes\Resources\Properties\Filterable; +use MorningTrain\Economic\Attributes\Resources\Properties\PrimaryKey; use MorningTrain\Economic\Attributes\Resources\Properties\ResourceType; use MorningTrain\Economic\Attributes\Resources\Properties\Sortable; use MorningTrain\Economic\Classes\EconomicCollection; @@ -73,6 +74,9 @@ class Product extends Resource #[Sortable] public string $year; + #[PrimaryKey] + public int $productNumber; + public static function create(DateTime $fromDate, DateTime $toDate): static { return static::createRequest(compact('fromDate', 'toDate')); diff --git a/tests/Unit/InvoiceTest.php b/tests/Unit/InvoiceTest.php index ed25bd5..82bcf60 100644 --- a/tests/Unit/InvoiceTest.php +++ b/tests/Unit/InvoiceTest.php @@ -31,6 +31,9 @@ ], 'lines' => [ [ + 'product' => [ + 'productNumber' => 1, + ], 'quantity' => 1, 'unitNetPrice' => 500, ],