NotificationsController.coffee 570 B

123456789101112131415
  1. NotificationsHandler = require("./NotificationsHandler")
  2. logger = require("logger-sharelatex")
  3. module.exports =
  4. getAllUnreadNotifications: (req, res)->
  5. NotificationsHandler.getUserNotifications req.session.user._id, (err, unreadNotifications)->
  6. res.send(unreadNotifications)
  7. markNotificationAsRead: (req, res)->
  8. user_id = req.session.user._id
  9. notification_id = req.params.notification_id
  10. NotificationsHandler.markAsRead user_id, notification_id, ->
  11. res.send()
  12. logger.log user_id:user_id, notification_id:notification_id, "mark notification as read"