content.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 置顶
  5. istop: { type: Boolean, required: false, default: false },
  6. // 排序 发布时间
  7. date: { type: Number, required: false },
  8. // 添加时间
  9. createAt: { type: Number, required: true },
  10. // 修改时间
  11. updateAt: { type: Number, required: true },
  12. // 缩略图
  13. thumbnail: { type: String, required: false },
  14. // 标题
  15. title: { type: String, required: true },
  16. // 描述
  17. describe: { type: String, required: true },
  18. // 内容
  19. content: { type: String, required: true },
  20. // 绑定栏目
  21. bind: { type: String, required: true },
  22. // 访问量
  23. visit: { type: Number, required: false, default: 0 },
  24. // 推荐
  25. recommend: { type: Boolean, required: false, default: false },
  26. // 附件
  27. annex: { type: String, required: false },
  28. // vip可见标识
  29. svip: { type: Boolean, required: false },
  30. // 是否显示
  31. isShow: { type: Boolean, required: false },
  32. // 状态 0=待发布 1=已发布
  33. status: { type: String, required: false },
  34. // 关键词
  35. keywords: { type: Array, required: false, default: [] },
  36. };
  37. const schema = new Schema(SchemaDefine);
  38. module.exports = app => {
  39. const { mongoose } = app;
  40. return mongoose.model('content', schema, 'content');
  41. };