Content.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. 'use strict';
  2. module.exports = app => {
  3. const { mongoose } = app;
  4. const { Schema } = mongoose;
  5. const ContentSchema = new Schema({
  6. // 标题
  7. title: {
  8. type: String,
  9. },
  10. // 摘要
  11. slug: {
  12. type: String,
  13. },
  14. // 缩略图
  15. thumbnail: {
  16. type: String,
  17. },
  18. // 附件
  19. annex: {
  20. type: String,
  21. },
  22. // 缩略图
  23. annexname: {
  24. type: String,
  25. },
  26. // 内容
  27. content: {
  28. type: String,
  29. },
  30. // 创建时间
  31. createAt: {
  32. type: String,
  33. },
  34. // 置顶
  35. istop: {
  36. type: Number,
  37. },
  38. // 数据id
  39. id: {
  40. type: String,
  41. },
  42. // 绑定菜单组
  43. menus: {
  44. type: String,
  45. },
  46. // 文章年
  47. year: {
  48. type: String,
  49. },
  50. // 文章日期
  51. date: {
  52. type: String,
  53. },
  54. // 访问量
  55. hits: {
  56. type: Number,
  57. default: 0,
  58. },
  59. // 第多少期
  60. term: {
  61. type: String,
  62. },
  63. // 排序
  64. sort: {
  65. type: Number,
  66. default: 0,
  67. },
  68. });
  69. return mongoose.model('Content', ContentSchema);
  70. };