GlobalNotificationSetting.js 982 B

12345678910111213141516171819202122232425262728293031323334
  1. // disable no-return-await for model functions
  2. /* eslint-disable no-return-await */
  3. const mongoose = require('mongoose');
  4. const GlobalNotificationSetting = require('./GlobalNotificationSetting/index');
  5. const GlobalNotificationSettingClass = GlobalNotificationSetting.class;
  6. const GlobalNotificationSettingSchema = GlobalNotificationSetting.schema;
  7. /**
  8. * global notifcation event master
  9. */
  10. GlobalNotificationSettingSchema.statics.EVENT = {
  11. PAGE_CREATE: 'pageCreate',
  12. PAGE_EDIT: 'pageEdit',
  13. PAGE_DELETE: 'pageDelete',
  14. PAGE_MOVE: 'pageMove',
  15. PAGE_LIKE: 'pageLike',
  16. COMMENT: 'comment',
  17. };
  18. /**
  19. * global notifcation type master
  20. */
  21. GlobalNotificationSettingSchema.statics.TYPE = {
  22. MAIL: 'mail',
  23. SLACK: 'slack',
  24. };
  25. module.exports = function(crowi) {
  26. GlobalNotificationSettingClass.crowi = crowi;
  27. GlobalNotificationSettingSchema.loadClass(GlobalNotificationSettingClass);
  28. return mongoose.model('GlobalNotificationSetting', GlobalNotificationSettingSchema);
  29. };