thousand.js 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 信息表
  5. const ThousandSchema = {
  6. title: { type: String, required: false, maxLength: 128 }, // 标题
  7. pic: { type: String, required: false, maxLength: 256 }, // 标题图片URL
  8. content: { type: String, required: false, maxLength: 102400, select: false }, // 内容详情
  9. abstract: { type: String, required: false, maxLength: 500 }, // 内容简介
  10. type: { type: String, required: false, maxLength: 5 }, // 所属类型
  11. parent_id: { type: String, required: false, maxLength: 64 }, // 所属id
  12. parent: { type: String, required: false, maxLength: 100 }, // 所属名称
  13. publish_time: String, // 发布时间
  14. url: { type: String, required: false, maxLength: 256 }, // 外部链接
  15. info_type: { type: String, required: false, maxLength: 256, default: '0' }, // 信息类型 0、普通 1、外链
  16. is_use: { type: String, required: false, maxLength: 5 }, // 是否使用,0=>使用中;1=>已禁止
  17. news_type: { type: String, default: 1, maxLength: 5 }, // 0抓取,1正常输入
  18. origin: { type: String, required: false, maxLength: 200 }, // 发布来源
  19. };
  20. const schema = new Schema(ThousandSchema, { toJSON: { virtuals: true } });
  21. schema.index({ id: 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('Thousand', schema, 'market_thousand');
  26. };