I need to find a way to return all requested relat...
# orm-help
h
I need to find a way to return all requested relational data on a subscription... using Apollo/Prisma/GraphQLYoga.... I have the following here:
Copy code
Subscription: {
    tripStatusUpdated: {
      subscribe: withFilter(
        () => return pubsub.asyncIterator(Events.TRIP_STATUS_UPDATED),
        (payload, variables) => {
          console.log('PAYLOAD: ', payload)
          return payload.tripStatusUpdated.tripID === variables.tripID
        },
      ),
    },
}
This only returns the item dispatched with the event, and not the requested data from the subscription. Is there any way to request certain fields on a model from the subscription?
h
No, but I did figure it out -- I can add a resolver to the subscription and mutate the payload before it goes out
thanks!
that does lead me to a different question, though, @lawjolla -- using prisma binding to query all records of a certain type... how do I filter only records with a certain relation? Like... using prisma binding on
context.db
to get all
users
with
posts
or some such?
l
Are you looking for all posts from all users? Certain posts from users? A user with all posts? Or a user with certain posts?
h
all users with posts
i've tried
Copy code
where: {relation_not: null}
But that didn't seem to work