anyone created notification systems on top of thei...
# orm-help
z
anyone created notification systems on top of their graphql api? How do you implement it? Do you fire a
createNotification
type of function in your resolvers or use some sort of middleware?
n
what kind of notification system are you talking about?
l
I've been giving some thought to this. Generically, it should probably be implemented in a schema directive. No matter which way you cut it, there will be a lot of code, but that's probably the best way to manage it.
If you want to get queasy, here's how much logic Slack uses to decide if it should send you a notification. https://pbs.twimg.com/media/C6A7smLUsAAzJeS.jpg:large
z
Building basic notifications for my users e.g. someone comments on their profile, they get notified
Schema directive approach sounds interesting. I haven’t used directives much but if they act like middleware, that sounds like it works?
l
No one has really used them... they're brand new. 🙂 But yes, they're like middleware. https://www.apollographql.com/docs/graphql-tools/schema-directives.html
z
can you use these on mutations though?
l
I haven't read the docs
z
l
Apollo drives the standards, so I would go with that. But up to you
m
you might be interested in this as well - we’ll be releasing it in no time and some feedback would be more than welcome https://github.com/graphcool/graphql-middleware/blob/rewrite/README.md
❤️ 1
👀 1
l
@matic wow! How do you see it integrating with the graph tools schema directives? EDIT: Oh, you answer that in the readme 🙈