GlobalNotificationSetting.js 913 B

12345678910111213141516171819202122232425
  1. const debug = require('debug')('growi:models:GlobalNotificationSetting');
  2. const mongoose = require('mongoose');
  3. const GlobalNotificationSetting = require('./GlobalNotificationSetting/index');
  4. /**
  5. * create child schemas inherited from parentSchema
  6. * all child schemas are stored in globalnotificationsettings collection
  7. * @link{http://url.com module_name}
  8. * @param {object} parentSchema
  9. * @param {string} modelName
  10. * @param {string} discriminatorKey
  11. */
  12. const createChildSchemas = (parentSchema, modelName, discriminatorKey) => {
  13. const Notification = mongoose.model(modelName, parentSchema);
  14. return {
  15. Parent: Notification,
  16. };
  17. };
  18. module.exports = function(crowi) {
  19. GlobalNotificationSetting.class.crowi = crowi;
  20. GlobalNotificationSetting.schema.loadClass(GlobalNotificationSetting.class);
  21. return createChildSchemas(GlobalNotificationSetting.schema, 'GlobalNotificationSetting', 'type');
  22. };