Add low stock endpoint
This commit is contained in:
@@ -87,6 +87,15 @@ public class StockService(
|
||||
items.Select(b => MapBalance(b, names.GetValueOrDefault(b.LocationId, "—"))).ToList());
|
||||
}
|
||||
|
||||
public async Task<List<LowStockItemResponse>> GetLowStockAsync(Guid? locationId)
|
||||
{
|
||||
var balances = await repo.GetLowStockAsync(locationId);
|
||||
var names = await ResolveLocationNamesAsync(balances.Select(b => (b.LocationId, b.LocationType)));
|
||||
return balances.Select(b => new LowStockItemResponse(
|
||||
b.FK_ItemId, b.Item.Name, b.LocationId, names.GetValueOrDefault(b.LocationId, "—"),
|
||||
b.Quantity, b.Item.ReorderLevel!.Value)).ToList();
|
||||
}
|
||||
|
||||
public async Task<StockTotalResponse?> GetItemTotalAsync(Guid itemId)
|
||||
{
|
||||
var item = await itemRepo.GetByIdAsync(itemId);
|
||||
|
||||
Reference in New Issue
Block a user