newsroadshow.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 信息表
  5. const NewsroadshowSchema = {
  6. dock_id: { type: String, required: false, maxLength: 500 }, // 栏目id
  7. title: { type: String, required: false, maxLength: 500 }, // 标题
  8. titlejj: { type: String, required: false, maxLength: 500 }, // 标题简介
  9. orgin: { type: String, required: false, maxLength: 500 }, // 来源
  10. publish: { type: String, required: false, maxLength: 500 }, // 发布者
  11. publish_time: { type: String, required: false, maxLength: 500 }, // 发布时间
  12. uid: { type: String, required: false, maxLength: 500 }, // 用户id
  13. content: { type: String, required: false }, // 正文
  14. picture: { type: String, required: false }, // 图片路径
  15. filepath: { type: String, required: false }, // 文件路径
  16. };
  17. const schema = new Schema(NewsroadshowSchema, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ dock_id: 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Newsroadshow', schema, 'live_news_roadshow');
  24. };