12345678910111213141516171819 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 职务表
- const LevelSchema = {
- dept_id: { type: String, required: true, maxLength: 200 }, // 部门id
- name: { type: String, required: true, maxLength: 200 }, // 职务名称
- };
- const schema = new Schema(LevelSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Level', schema, 'level');
- };
|