@CosmicPangolin1 see if this does what you are looking for. I have not tested this, and is dependent on cascade working with aliased fields, which I am not confident it does.
query {
getUser( ... need an id of some sort here ... ) {
posts @cascade(fields:["thumbs_up","clap"]) {
content
thumbs_up: reactions(filter: {
type: {eq: "thumbs_up" }
}) @cascade {
type
}
clap: reactions(filter: {
type: {eq: "clap" }
}) @cascade {
type
}
reactions {
type
user { name }
}
}
}
}
If this works, here is the explanation: We add two additional aliased edges for reactions. These can be ignored by the client, but they are dependent for the top level cascade to work. In these aliased edges, we ask for all of the thumb up reactions in one, and all of the clap reactions in the other. Now all we have to do is use cascade at the post level to filter out the posts that do not have both a thumbs up and a clap. Then we add another edge to reactions to get all of the reactions regardless of the type. The cascade on the aliased edges are to reset the parameterized cascade on these edges so that it is still not filtering out ones reactions that don’t have a thumbs_up and clap fields, which reactions doesn’t have.
If you know that all reactions will have a user and all users will have a name, and you are not getting any more information from the user besides his post at the top level, then you can instead just use a non parameterized cascade at the top level beside getUser.
query {
getUser( ... need an id of some sort here ... ) @cascade {
posts {
content
thumbs_up: reactions(filter: {
type: {eq: "thumbs_up" }
}) {
type
}
clap: reactions(filter: {
type: {eq: "clap" }
}) {
type
}
reactions {
type
user { name }
}
}
}
}
Oh, and be sure to add in the id filter for getUser. Your initial schema in the OP is invalid with this query though, because there is not any ID or @id field for User, this would not generate the getUser query. Also User does not have a name field. I will assume that it was a partial schema only and not your actual schema.