'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { Secret } = require('naf-framework-mongoose/lib/model/schema'); // 菜单权限表 const MenuroleSchema = { fid: { type: String, required: false, maxLength: 200, default: '0' }, // 父ID name: { type: String, required: true, maxLength: 200 }, // 名称 url: { type: String, required: false, maxLength: 200 }, // 路径 }; const schema = new Schema(MenuroleSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Menurole', schema, 'menu_role'); };