site.js 1.2 KB

1234567891011121314151617181920212223
  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. logo: { type: String, required: false, maxLength: 256 }, // 网站logo图片URL
  12. copyright: { type: String, required: false, maxLength: 256 }, // 版权声明
  13. theme: { type: String, default: 'default', maxLength: 64 }, // 样式主题
  14. content: { type: String, required: true, maxLength: 102400, select: false }, // 站点介绍/联系方式
  15. remark: { type: String, maxLength: 500 }, // 备注
  16. };
  17. const schema = new Schema(SchemaDefine, { 'multi-tenancy': false, toJSON: { virtuals: true } });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('SiteInfo', schema, 'cms_site');
  22. };