menurole.js 714 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  5. // 菜单权限表
  6. const MenuroleSchema = {
  7. fid: { type: String, required: false, maxLength: 200, default: '0' }, // 父ID
  8. name: { type: String, required: true, maxLength: 200 }, // 名称
  9. url: { type: String, required: false, maxLength: 200 }, // 路径
  10. };
  11. const schema = new Schema(MenuroleSchema, { toJSON: { virtuals: true } });
  12. schema.index({ id: 1 });
  13. schema.plugin(metaPlugin);
  14. module.exports = app => {
  15. const { mongoose } = app;
  16. return mongoose.model('Menurole', schema, 'menu_role');
  17. };