fix(medusa): Only add ordering select if not already present (#3319)
This commit is contained in:
@@ -16,13 +16,17 @@ export function getListQuery(
|
||||
const inventoryItemRepository = manager.getRepository(InventoryItem)
|
||||
|
||||
const { q, ...selectorRest } = selector
|
||||
const query = buildQuery(selectorRest, config) as ExtendedFindConfig<InventoryItem> & {
|
||||
where: FindOptionsWhere<InventoryItem & {
|
||||
location_id?: string
|
||||
}>
|
||||
const query = buildQuery(
|
||||
selectorRest,
|
||||
config
|
||||
) as ExtendedFindConfig<InventoryItem> & {
|
||||
where: FindOptionsWhere<
|
||||
InventoryItem & {
|
||||
location_id?: string
|
||||
}
|
||||
>
|
||||
}
|
||||
|
||||
|
||||
const queryBuilder = inventoryItemRepository.createQueryBuilder("inv_item")
|
||||
|
||||
if (q) {
|
||||
@@ -65,7 +69,9 @@ export function getListQuery(
|
||||
const toSelect: string[] = []
|
||||
const parsed = Object.entries(query.order).reduce((acc, [k, v]) => {
|
||||
const key = `inv_item.${k}`
|
||||
toSelect.push(key)
|
||||
if (!query.select?.[k]) {
|
||||
toSelect.push(key)
|
||||
}
|
||||
acc[key] = v
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
Reference in New Issue
Block a user