GlobalNotificationSetting.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. export const GlobalNotificationSettingEvent = {
  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. export const GlobalNotificationSettingType = {
  22. MAIL: 'mail',
  23. SLACK: 'slack',
  24. };
  25. /** @param {import('~/server/crowi').default} crowi Crowi instance */
  26. const factory = (crowi) => {
  27. GlobalNotificationSettingClass.crowi = crowi;
  28. GlobalNotificationSettingSchema.loadClass(GlobalNotificationSettingClass);
  29. return mongoose.model(
  30. 'GlobalNotificationSetting',
  31. GlobalNotificationSettingSchema,
  32. );
  33. };
  34. export default factory;