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:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Domain\Contracts;
|
||||
|
||||
use App\Modules\Inventory\Domain\Entities\StockItemGroup;
|
||||
|
||||
interface StockItemGroupRepository
|
||||
{
|
||||
public function findById(int $id): ?StockItemGroup;
|
||||
|
||||
public function save(StockItemGroup $group): StockItemGroup;
|
||||
|
||||
public function isNameTaken(string $name, ?int $exceptId = null): bool;
|
||||
|
||||
public function nextSortOrder(): int;
|
||||
|
||||
/**
|
||||
* The group just before ($up) or after it in order, if any.
|
||||
*/
|
||||
public function neighbour(StockItemGroup $group, bool $up): ?StockItemGroup;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Domain\Contracts;
|
||||
|
||||
use App\Modules\Inventory\Domain\Entities\StockItem;
|
||||
|
||||
interface StockItemRepository
|
||||
{
|
||||
public function findById(int $id): ?StockItem;
|
||||
|
||||
/**
|
||||
* The item, locked until the end of the transaction, so that its
|
||||
* balance and average cost change one movement at a time.
|
||||
*/
|
||||
public function lockById(int $id): ?StockItem;
|
||||
|
||||
public function save(StockItem $item): StockItem;
|
||||
|
||||
public function isNameTaken(string $name, ?int $exceptId = null): bool;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Domain\Contracts;
|
||||
|
||||
use App\Modules\Inventory\Domain\Entities\StockMovement;
|
||||
|
||||
interface StockMovementRepository
|
||||
{
|
||||
public function add(StockMovement $movement): StockMovement;
|
||||
|
||||
public function findById(int $id): ?StockMovement;
|
||||
|
||||
public function isReversed(int $movementId): bool;
|
||||
|
||||
/**
|
||||
* The item's balance in thousandths: the sum of its movements.
|
||||
*/
|
||||
public function balanceOf(int $itemId): int;
|
||||
}
|
||||
Reference in New Issue
Block a user