NotificationsController.coffee 786 B

12345678910111213141516171819
  1. Notifications = require("./Notifications")
  2. logger = require("logger-sharelatex")
  3. module.exports =
  4. getUserNotifications: (req, res)->
  5. logger.log user_id: req.params.user_id, "getting user unread notifications"
  6. Notifications.getUserUnreadNotifications req.params.user_id, (err, notifications)->
  7. res.json(notifications)
  8. addNotification: (req, res)->
  9. logger.log user_id: req.params.user_id, notification:req.body, "adding notification"
  10. Notifications.addNotification req.params.user_id, req.body, (err, notifications)->
  11. res.send()
  12. removeNotificacion: (req, res)->
  13. logger.log user_id: req.params.user_id, notification_key:req.params.key "removing notification"
  14. Notifications.removeNotification req.params.user_id, req.params.key, (err, notifications)->
  15. res.send()