site.js 1.1 KB

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 站点信息
  5. const SchemaDefine = {
  6. site: { type: String, required: true, maxLength: 64, unique: true }, // 分站标识
  7. name: { type: String, required: true, maxLength: 64 }, // 站点名称
  8. status: { type: String, default: '0', maxLength: 64 }, // 站点状态:0-正常;1-未激活;2-注销
  9. domain: { type: String, required: true, maxLength: 128 }, // 域名
  10. banner: { type: String, required: false, maxLength: 256 }, // 网站Banner图片URL
  11. copyright: { type: String, required: false, maxLength: 256 }, // 版权声明
  12. theme: { type: String, default: 'default', maxLength: 64 }, // 样式主题
  13. content: { type: String, required: true, maxLength: 102400, select: false }, // 站点介绍/联系方式
  14. remark: { type: String, maxLength: 500 }, // 备注
  15. };
  16. const schema = new Schema(SchemaDefine, { 'multi-tenancy': false, toJSON: { virtuals: true } });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('SiteInfo', schema, 'cms_site');
  21. };