menu.js 859 B

1234567891011121314151617181920212223242526272829
  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. parentCode: { type: String, required: false },
  20. // 是否显示
  21. isshow: { type: Boolean, required: false },
  22. // 模板
  23. template: { type: String, required: false },
  24. };
  25. const schema = new Schema(SchemaDefine);
  26. module.exports = app => {
  27. const { mongoose } = app;
  28. return mongoose.model('menu', schema, 'menu');
  29. };