You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The API needs to have the following 3 core resolvers:
createTask => creates a task in db
updateTask => update a task in db
subscribeTasks => subscribe to tasks given a filter parameter, and the tasks subscribed need to update whenever a Task is created or updated
⚠️My biggest question:
How do I make sure subscribeTasks resolver only updates the tasks subscribed BASED ON CHANGES IN THE DB? (rather than triggering updates all the tasks subscribed using PubSub by publishing pubSubEvents in createTask and updateTask resolvers?)
I also need a proper filter to be applied on subscribeTasks resolver. So that I can write subscription queries like how I'd do with a normal gql query like this:
How do you make a
Subscription
resolver independent of resolvers forCreating
andUpdating
records❌ Current behaviour:
subscribeTasks
resolver doesn't have proper filters, nor does it return me the latestTask
items✔️ Expected behaviour:
subscribeTasks
resolver returns me allTask
items given a filter parameter (based onTaskWhereInput
) in the queryI'm building a GraphQL API using NestJS.
The API is simple, it has to do CRUD operations on
Task
entity - I'm using PostgreSQLData model:
The API needs to have the following 3 core resolvers:
createTask
=> creates a task in dbupdateTask
=> update a task in dbsubscribeTasks
=> subscribe to tasks given a filter parameter, and the tasks subscribed need to update whenever aTask
is created or updatedHow do I make sure
subscribeTasks
resolver only updates the tasks subscribed BASED ON CHANGES IN THE DB? (rather than triggering updates all the tasks subscribed usingPubSub
by publishingpubSubEvents
increateTask
andupdateTask
resolvers?)I also need a proper filter to be applied on
subscribeTasks
resolver. So that I can write subscription queries like how I'd do with a normal gql query like this:TaskWhereInput:
This is how my resolvers look like:
Speaking of subscription filters, I also have no idea how to apply what's on NestJS doc in my use case (MANY filters, not just one)
NestJS doc filter demo:
The text was updated successfully, but these errors were encountered: