-
I am following marketplace recipe example https://github.com/medusajs/examples/blob/main/marketplace/src/api/vendors/products/route.ts. Here we are getting vendor and related products of this vendor: // vendors/products/route.ts
const query = remoteQueryObjectFromString({
entryPoint: "vendor",
fields: ["products.*"],
variables: {
filters: {
id: [vendorAdmin.vendor.id]
}
}
}) This implementation will not work with pagination (because pagination will apply for vendor entity and not for a product). So instead of making entryPoint as "vendor" i need to make it "product". // vendors/products/route.ts
const query = remoteQueryObjectFromString({
entryPoint: "product",
fields: [".*", "vendor.*"],
variables: {
filters: {
vendor: [vendorAdmin.vendor.id] // vendor_id doesn't work either
},
take: 15
}
}) Is that even possible in the current stage of 2.0? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@carlos-r-l-rodrigues of Medusa core team replied me on a Discord channel with this information: Cross module filtering/sorting is not yet supported in the 2.0 preview release. At the moment, as an alternative, you can query from your link filtering it by vendor_id and expanding products. const yourLink = yourDefineLinkReturn // import the reference of your defineLink here
const query = remoteQueryObjectFromString({
service: yourLink.serviceName,
fields: ["vendor.*", "product.*"],
variables: {
filters: {
vendor_id: [vendorAdmin.vendor.id]
},
take: 15
}
}) |
Beta Was this translation helpful? Give feedback.
@carlos-r-l-rodrigues of Medusa core team replied me on a Discord channel with this information:
Cross module filtering/sorting is not yet supported in the 2.0 preview release.
It will be available soon as a new module that you will be able to do it.
At the moment, as an alternative, you can query from your link filtering it by vendor_id and expanding products.
something like this: