GlobalNotificationSlackSetting.js 887 B

12345678910111213141516171819202122232425
  1. import mongoose from 'mongoose';
  2. import { GlobalNotificationSettingType } from '../GlobalNotificationSetting';
  3. const GlobalNotificationSetting = require('./index');
  4. const GlobalNotificationSettingClass = GlobalNotificationSetting.class;
  5. const GlobalNotificationSettingSchema = GlobalNotificationSetting.schema;
  6. module.exports = function(crowi) {
  7. GlobalNotificationSettingClass.crowi = crowi;
  8. GlobalNotificationSettingSchema.loadClass(GlobalNotificationSettingClass);
  9. const GlobalNotificationSettingModel = mongoose.model('GlobalNotificationSetting', GlobalNotificationSettingSchema);
  10. const GlobalNotificationSlackSettingModel = GlobalNotificationSettingModel.discriminator(
  11. GlobalNotificationSettingType.SLACK,
  12. new mongoose.Schema({
  13. slackChannels: String,
  14. }, {
  15. discriminatorKey: 'type',
  16. }),
  17. );
  18. return GlobalNotificationSlackSettingModel;
  19. };