menu.js 669 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 排序
  5. date: { type: Number, required: false },
  6. // 编码
  7. code: { type: String, required: true },
  8. // 名称
  9. name: { type: String, required: true },
  10. // 类型
  11. type: { type: String, required: true }, // 0 = 栏目 1 = 单页 2 = 链接
  12. // 链接地址
  13. url: { type: String, required: false },
  14. // 绑定栏目
  15. column: { type: Array, required: false },
  16. // 绑定单页
  17. pages: { type: String, required: false },
  18. };
  19. const schema = new Schema(SchemaDefine);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('menu', schema, 'menu');
  23. };