feat: [재고] 통계 API에 최대재고 초과 카운트 추가

- stats() 메서드에 over_count (status='over') 쿼리 추가
This commit is contained in:
김보곤
2026-03-23 09:04:49 +09:00
parent 7726b81933
commit be711d8b6e

View File

@@ -159,6 +159,14 @@ public function stats(): array
})
->count();
// 최대재고 초과 (status = 'over')
$overCount = Item::where('items.tenant_id', $tenantId)
->byItemTypes($stockItemTypes)
->whereHas('stock', function ($q) {
$q->where('status', 'over');
})
->count();
// 재고 정보가 없는 Item 수
$noStockCount = Item::where('items.tenant_id', $tenantId)
->byItemTypes($stockItemTypes)
@@ -170,6 +178,7 @@ public function stats(): array
'normal_count' => $normalCount,
'low_count' => $lowCount,
'out_count' => $outCount,
'over_count' => $overCount,
'no_stock_count' => $noStockCount,
];
}