123456789101112131415161718 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 部门表
- const DepartmentSchema = {
- name: { type: String, required: false, maxLength: 500 }, // 部门名称
- };
- const schema = new Schema(DepartmentSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Department', schema, 'department');
- };
|