fix(medusa): Pass query transformer config in storefront controllers (#3219)
This commit is contained in:
@@ -53,10 +53,7 @@ export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
const orderService: OrderService = req.scope.resolve("orderService")
|
||||
const order = await orderService.retrieveWithTotals(id, {
|
||||
select: defaultStoreOrdersFields,
|
||||
relations: defaultStoreOrdersRelations,
|
||||
})
|
||||
const order = await orderService.retrieveWithTotals(id, req.retrieveConfig)
|
||||
|
||||
res.json({
|
||||
order: cleanResponseData(order, req.allowedProperties || []),
|
||||
|
||||
@@ -92,10 +92,7 @@ export default async (req, res) => {
|
||||
display_id: validated.display_id,
|
||||
email: validated.email,
|
||||
},
|
||||
{
|
||||
select: defaultStoreOrdersFields,
|
||||
relations: defaultStoreOrdersRelations,
|
||||
}
|
||||
req.listConfig
|
||||
)
|
||||
|
||||
if (orders.length !== 1) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IdMap } from "medusa-test-utils"
|
||||
import { defaultStoreProductsRelations } from ".."
|
||||
import { defaultStoreProductsFields, defaultStoreProductsRelations } from ".."
|
||||
import { request } from "../../../../../helpers/test-request"
|
||||
import { ProductServiceMock } from "../../../../../services/__mocks__/product"
|
||||
|
||||
@@ -22,6 +22,7 @@ describe("Get product by id", () => {
|
||||
expect(ProductServiceMock.retrieve).toHaveBeenCalledWith(
|
||||
IdMap.getId("product1"),
|
||||
{
|
||||
select: defaultStoreProductsFields,
|
||||
relations: defaultStoreProductsRelations,
|
||||
}
|
||||
)
|
||||
@@ -54,6 +55,7 @@ describe("Get product by id", () => {
|
||||
expect(ProductServiceMock.retrieve).toHaveBeenCalledWith(
|
||||
IdMap.getId("variantsWithPrices"),
|
||||
{
|
||||
select: defaultStoreProductsFields,
|
||||
relations: defaultStoreProductsRelations,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -84,9 +84,7 @@ export default async (req, res) => {
|
||||
const pricingService: PricingService = req.scope.resolve("pricingService")
|
||||
const cartService: CartService = req.scope.resolve("cartService")
|
||||
const regionService: RegionService = req.scope.resolve("regionService")
|
||||
const rawProduct = await productService.retrieve(id, {
|
||||
relations: defaultStoreProductsRelations,
|
||||
})
|
||||
const rawProduct = await productService.retrieve(id, req.retrieveConfig)
|
||||
|
||||
let sales_channel_id = validated.sales_channel_id
|
||||
const featureFlagRouter: FlagRouter = req.scope.resolve("featureFlagRouter")
|
||||
|
||||
Reference in New Issue
Block a user