medusajs/medusa-eats

Remote query

Closed this issue · 0 comments

const categories = await productService.listCategories(

Here I suggest that you use the remote query and pass take: null instead of a static number, something like: (it would be the same for all end points)

const remoteQuery = req.scope.resolve('remoteQuery')
const query = remoteQueryObjectFromString({
  entryPoint: "product_categories",
  variables: {
    take: null
  },
  fields: ["id", "name"],
})
const { rows: categories, metadata } = await remoteQuery(queryObject)