imgtxtdock.js 954 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const images = new Schema({
  5. name: { type: String, required: true, maxLength: 500 }, // 图片名称
  6. url: { type: String, required: true, maxLength: 500 }, // 图片路径
  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. file_path: { type: String, required: false }, // 视频路径
  15. };
  16. const schema = new Schema(ImgtxtdockSchema, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('Imgtxtdock', schema, 'imgtxtdock');
  22. };