flower.js 622 B

1234567891011121314151617181920
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 栏目表
  5. const FlowerSchema = {
  6. name: { type: String, required: true, maxLength: 500 }, // 名称
  7. type: { type: String, required: false, maxLength: 500 }, // 类别
  8. dock_id: { type: String, required: false, maxLength: 500 }, // 展会id
  9. };
  10. const schema = new Schema(FlowerSchema, { toJSON: { virtuals: true } });
  11. schema.index({ id: 1 });
  12. schema.plugin(metaPlugin);
  13. module.exports = app => {
  14. const { mongoose } = app;
  15. return mongoose.model('Flower', schema, 'flower');
  16. };