hi everyone, I was wondering if someone could give...
# prisma-whats-new
r
hi everyone, I was wondering if someone could give me some pointers to make a notification system for likes and comments etc. with graphcool subscriptions. I was thinking of making a Notification entity and then subscribe to it and filter on which ones are relevant for the current user. However, I was wondering if there was a more performant way to do it. The filtering would happen in the frontend so the app would get ALL notification updates of which maybe 5% are actually relevant to that user. Is there a server side filtering possible? Or is there a better way to do this?
r
Does the filtering happen server side?
h
yea
r
Perfect 🙂 I was under the impression it happened clientside
thanks!
a
I would actually use a combination of the techniques. Create a Notification node server-side, so you are in control of what generates a notification and what not. Then, use a client-side subscription for it. And if you restrict read permissions to a user's own notifications, I don't even think you have to apply a filter to the subscription on the client.
r
I was going to use something like that. Just create a Notification when certain actions occur and then filtering on the user id to whom the notification is sent
I should read more about the permissions I guess, havent really worked with it very much
a
With a permission query, you can basically say: user can only read his own Notifications. Then you don't have to filter
r
is there a blog article about the usage of the permission system?
I should read up on it
a
Because remember that the API is accessible by any logged in user, so even though you specify a filter in the client, there's nothing preventing a user from running his own subscription query without the filter. That's why you need permissions
r
Got it
👍🏻 1