Add stock items, groups and movements at a moving average cost

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 16:18:59 +02:00
co-authored by Claude Sonnet 5.5
parent 361a2974cf
commit 30132deb0e
81 changed files with 4968 additions and 115 deletions
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Modules\Inventory\Application\Contracts;
use App\Modules\Inventory\Domain\Exceptions\InvalidStockImage;
/**
* Keeps the image files of stock items, which help recognise them on a
* touch screen: an upright JPEG without metadata and its thumbnail.
*/
interface StockItemImages
{
/**
* @return array{path: string, thumbnailPath: string}
*
* @throws InvalidStockImage
*/
public function store(string $uploadedFilePath, int $itemId): array;
/**
* @param list<string> $paths
*/
public function delete(array $paths): void;
}
@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Modules\Inventory\Application\Contracts;
use App\Modules\Inventory\Application\DTOs\StockGroupSummary;
use App\Modules\Inventory\Application\DTOs\StockItemSummary;
use App\Modules\Inventory\Application\DTOs\StockMovementSummary;
/**
* Reads stock items, groups and movements. Other modules (machines, quick
* sales, jobs' task material) read stock through this contract.
*/
interface StockQueries
{
/**
* @return list<StockGroupSummary> In order.
*/
public function groups(bool $includeInactive = true): array;
/**
* Items in group order and then by name. $search matches parts of the
* name or code regardless of case and Finnish letters.
*
* @return list<StockItemSummary>
*/
public function items(?string $search = null, ?int $groupId = null, bool $onlyReorder = false, bool $includeInactive = false): array;
public function findItem(int $id): ?StockItemSummary;
/**
* @param list<int> $ids
* @return array<int, StockItemSummary> By id.
*/
public function itemsByIds(array $ids): array;
/**
* The item's movements, newest first, with the balance after each.
*
* @return list<StockMovementSummary>
*/
public function movementsOf(int $itemId, int $limit = 200): array;
public function findMovement(int $id): ?StockMovementSummary;
/**
* The private-disk path of the item's image or its thumbnail.
*/
public function imagePathOf(int $itemId, bool $thumbnail): ?string;
}