12345678910111213141516171819202122 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 首页模块管理
- const indexModule = {
- name: { type: String, required: false, zh: '模块名称' }, //
- to_type: { type: String, required: false, zh: '跳转类型' }, // 字典:to_type
- to: { type: String, required: false, zh: '跳转至' }, //
- is_use: { type: String, required: false, zh: '是否使用' }, // 字典:use
- };
- const schema = new Schema(indexModule, { toJSON: { getters: true, virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.index({ name: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('IndexModule', schema, 'indexModule');
- };
|