pages.js 655 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 添加时间
  5. createAt: { type: Number, required: true },
  6. // 修改时间
  7. updateAt: { type: Number, required: true },
  8. // 编码
  9. code: { type: String, required: true },
  10. // 标题
  11. title: { type: String, required: true },
  12. // 描述
  13. describe: { type: String, required: true },
  14. // 内容
  15. content: { type: String, required: true },
  16. // 访问量
  17. visit: { type: Number, required: false, default: 0 },
  18. };
  19. const schema = new Schema(SchemaDefine);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('pages', schema, 'pages');
  23. };