0

Is it possible to 'filter' (where) by an extended schema in stitching file in graphQL?

For example:

{
  contractSKUCost(where: { contractSKU: { products: { productId: 1}} }) {
    items {
      id
      contractSKU {
        id
        products {
           productId
        }
      }
    }
  }
}

In this case, products is in a different database, that is why we need to define it in stitching file:

extend type ContractSKU {
    products():[Product]
    @delegate(
        schema: "products",
        path: "productsBySkuId(skuId: $fields:id)"
    )

Essentially, what I want to do is "GET All ContractSKUCost that have ProductId = 1". But as you see, ContractSKUCost does not have direct relationship with Product, only its parent ContractSKU.

Edit:

Code above does not work; because ContractSkuCost schema technically does not know the 'product' extension yet.

Water
  • 1,114
  • 1
  • 15
  • 31

0 Answers0