dictionary.js 374 B

123456789101112
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. code: { type: String, required: true },
  5. name: { type: String, required: true },
  6. parentCode: { type: String, required: true },
  7. };
  8. const schema = new Schema(SchemaDefine);
  9. module.exports = app => {
  10. const { mongoose } = app;
  11. return mongoose.model('dictionary', schema, 'dictionary');
  12. };