fix(medusa, admin-ui): List all inventory levels (#3552)
* ensure that all levels are listed * add changeset * remove count from config * update changeset version bump --------- Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
Oliver Windall Juhl
parent
cd54c7dca9
commit
0695ff642b
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
FilterableInventoryLevelProps,
|
||||
IInventoryService,
|
||||
InventoryItemDTO,
|
||||
InventoryLevelDTO,
|
||||
@@ -25,9 +26,14 @@ export const getLevelsByInventoryItemId = async (
|
||||
locationIds: string[],
|
||||
inventoryService: IInventoryService
|
||||
): Promise<Record<string, LevelWithAvailability[]>> => {
|
||||
const [levels] = await inventoryService.listInventoryLevels({
|
||||
const selector: FilterableInventoryLevelProps = {
|
||||
inventory_item_id: items.map((inventoryItem) => inventoryItem.id),
|
||||
})
|
||||
}
|
||||
if (locationIds.length) {
|
||||
selector.location_id = locationIds
|
||||
}
|
||||
|
||||
const [levels] = await inventoryService.listInventoryLevels(selector, {})
|
||||
|
||||
const levelsWithAvailability: LevelWithAvailability[] = await Promise.all(
|
||||
levels.map(async (level) => {
|
||||
|
||||
@@ -14,9 +14,12 @@ const joinSalesChannels = async (
|
||||
const salesChannelIds = await channelLocationService.listSalesChannelIds(
|
||||
location.id
|
||||
)
|
||||
const [salesChannels] = await salesChannelService.listAndCount({
|
||||
id: salesChannelIds,
|
||||
})
|
||||
const [salesChannels] = await salesChannelService.listAndCount(
|
||||
{
|
||||
id: salesChannelIds,
|
||||
},
|
||||
{}
|
||||
)
|
||||
|
||||
location.sales_channels = salesChannels
|
||||
|
||||
|
||||
Reference in New Issue
Block a user