feat: add optional inventory package association to service items and implement audit logging

- Added `inventory_package_uuid` and `inventory_package_title` fields to the `ServiceItem` interface.
- Updated API documentation to reflect new fields in service item responses.
- Implemented methods in `ClinicServiceController` to handle inventory package associations.
- Created `ServiceItemAuditLog` entity and repository for tracking changes to service items.
- Added functionality to log changes to service items, including inventory package associations.
- Implemented tests for attaching/detaching inventory packages and auditing changes.
- Created database migrations for new fields and audit log table.
This commit is contained in:
hamed
2026-07-18 12:26:15 +03:30
parent 42d9ad26c5
commit c4a661b542
14 changed files with 885 additions and 24 deletions
@@ -32,6 +32,28 @@ class InventoryPackageRepository extends ServiceEntityRepository
->getResult();
}
/**
* پکیج‌ها را با یک کوئری برمی‌گرداند (کلید = id) تا سریالایز کردن فهرست سرویس‌ها
* به find()-per-row نیفتد.
*
* @param int[] $ids
* @return array<int, InventoryPackage>
*/
public function findMapByIds(array $ids): array
{
$ids = array_values(array_unique(array_filter($ids)));
if ($ids === []) {
return [];
}
$map = [];
foreach ($this->findBy(['id' => $ids]) as $package) {
$map[$package->getId()] = $package;
}
return $map;
}
public function save(InventoryPackage $package): void
{
$this->getEntityManager()->persist($package);