Open deontologician opened 8 years ago
A simple notification scheme:
Users create documents in the 'notifications' collection. Each document has a sender, receiver and read field Permissions would be:
sender
receiver
read
collection('notifications').store({sender: context.id, recipient: any(), read: false})
collection('notifications').findAll({ recipient: context.id }).anyRead()
collection('notifications').update({ recipient: context.id, read: any() })
Users create a changefeed like hz('notifications').findAll({recipient: userId}).watch(), and can do store to send a notification to another user, and update to mark their own notifications as read.
hz('notifications').findAll({recipient: userId}).watch()
store
update
A simple notification scheme:
Users create documents in the 'notifications' collection.
Each document has a
sender
,receiver
andread
field Permissions would be:collection('notifications').store({sender: context.id, recipient: any(), read: false})
collection('notifications').findAll({ recipient: context.id }).anyRead()
collection('notifications').update({ recipient: context.id, read: any() })
Users create a changefeed like
hz('notifications').findAll({recipient: userId}).watch()
, and can dostore
to send a notification to another user, andupdate
to mark their own notifications as read.