2016-02-05 09:13:38 -05:00
|
|
|
|
|
|
|
NotificationsHandler = require("./NotificationsHandler")
|
|
|
|
|
|
|
|
module.exports =
|
|
|
|
|
|
|
|
groupPlan: (user, licence)->
|
|
|
|
key : "join-sub-#{licence.subscription_id}"
|
2016-06-13 08:38:30 -04:00
|
|
|
logger.log user_id:user_id, key:key, "creating notification key for user"
|
2016-02-05 09:13:38 -05:00
|
|
|
create: (callback = ->)->
|
|
|
|
messageOpts =
|
|
|
|
groupName: licence.name
|
|
|
|
subscription_id: licence.subscription_id
|
2016-02-17 11:24:09 -05:00
|
|
|
NotificationsHandler.createNotification user._id, @key, "notification_group_invite", messageOpts, callback
|
2016-02-05 09:13:38 -05:00
|
|
|
|
|
|
|
read: (callback = ->)->
|
2016-02-17 11:24:09 -05:00
|
|
|
NotificationsHandler.markAsReadWithKey user._id, @key, callback
|