1

Working with graphql java. I have schema like :

type Deal {
  id: Int!,
  type: Type,
  instruments: [Instrument]
  #.. other fields
}

type Instrument {
  id: Int!,
  name: String,
  legs: [Leg],
  #.. other fields

}
type Leg {
  id: Int!
  payments: [Payment],
  #.. other fields
}

type Payment {
  id: Int!,
  amount: Boolean!,
  account: Int!
  #.. other fields
}

The requirement is to fetch deal related payments with given filter criteria. the criteria contains fields from parents as well as child objects. The query looks like

type Query {
  dealPayments(filter: Filter):[Deal]
}

input Filter {
  type: Type, //field on Deal
  amountGreaterThan: Integer //field on Payment
  account: Integer //field on Payment
  # other conditions
}

I want to implement my resolvers in a way that enables me to retrieve all Deals which have payment account as given account.

query AllDealsforAccount($filter : {"account" = 123}) {
   Deal {
     id 
     instruments  {
       id
       legs {
         id
         payments (account: 123){
           id
           account
         }
       }
     }
   }
}

Now applying the corresponding criteria in child resolvers - the child object(payment) becomes null, but deal is still in the response. ** How to filter the parent deals based on child resolver? **

Any help would be appreciated. TIA

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.