feat: Add support for shipping options prices update (#7028)
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { getSetDifference, stringToSelectRelationObject } from "@medusajs/utils"
|
||||
import {
|
||||
getSetDifference,
|
||||
isPresent,
|
||||
stringToSelectRelationObject,
|
||||
} from "@medusajs/utils"
|
||||
import { pick } from "lodash"
|
||||
import { MedusaError, isDefined } from "medusa-core-utils"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
import { BaseEntity } from "../interfaces"
|
||||
import { FindConfig, QueryConfig, RequestQueryFields } from "../types/common"
|
||||
import { featureFlagRouter } from "../loaders/feature-flags"
|
||||
import MedusaV2 from "../loaders/feature-flags/medusa-v2"
|
||||
|
||||
export function pickByConfig<TModel extends BaseEntity>(
|
||||
obj: TModel | TModel[],
|
||||
@@ -24,7 +30,7 @@ export function prepareListQuery<
|
||||
T extends RequestQueryFields,
|
||||
TEntity extends BaseEntity
|
||||
>(validated: T, queryConfig: QueryConfig<TEntity> = {}) {
|
||||
const isMedusaV2 = process.env.MEDUSA_FF_MEDUSA_V2 == "true"
|
||||
const isMedusaV2 = featureFlagRouter.isFeatureEnabled(MedusaV2.key)
|
||||
|
||||
// TODO: this function will be simplified a lot once we drop support for the old api
|
||||
const { order, fields, limit = 50, expand, offset = 0 } = validated
|
||||
@@ -189,13 +195,14 @@ export function prepareListQuery<
|
||||
}
|
||||
}
|
||||
|
||||
const finalOrder = isPresent(orderBy) ? orderBy : undefined
|
||||
return {
|
||||
listConfig: {
|
||||
select: select.length ? select : undefined,
|
||||
relations: Array.from(allRelations),
|
||||
skip: offset,
|
||||
take: limit ?? defaultLimit,
|
||||
order: orderBy,
|
||||
order: finalOrder,
|
||||
},
|
||||
remoteQueryConfig: {
|
||||
// Add starFields that are relations only on which we want all properties with a dedicated format to the remote query
|
||||
@@ -207,7 +214,7 @@ export function prepareListQuery<
|
||||
? {
|
||||
skip: offset,
|
||||
take: limit ?? defaultLimit,
|
||||
order: orderBy,
|
||||
order: finalOrder,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user