GlobalNotificationSlackSetting.js 828 B

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