imgtxtdock.js 819 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 图片数组
  5. const images = new Schema({
  6. url: { type: String, required: true }, // 图片路径
  7. });
  8. // 栏目表
  9. const imgtxtdockSchema = {
  10. dock_id: { type: String, required: true, maxLength: 500 }, // 展会id
  11. user_name: { type: String, required: false, maxLength: 500 }, // 发言人
  12. brief: { type: String, required: false, maxLength: 500 }, // 发言文字内容
  13. image: { type: [ images ], select: true }, // 图片
  14. };
  15. const schema = new Schema(imgtxtdockSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('imgtxtdock', schema, 'imgtxt_dock');
  21. };