12345678910111213141516171819202122232425262728293031 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const ThousandSchema = {
- title: { type: String, required: false, maxLength: 128 },
- pic: { type: String, required: false, maxLength: 256 },
- content: { type: String, required: false, maxLength: 102400, select: false },
- abstract: { type: String, required: false, maxLength: 500 },
- type: { type: String, required: false, maxLength: 5 },
- parent_id: { type: String, required: false, maxLength: 64 },
- parent: { type: String, required: false, maxLength: 100 },
- publish_time: String,
- url: { type: String, required: false, maxLength: 256 },
- info_type: { type: String, required: false, maxLength: 256, default: '0' },
- is_use: { type: String, required: false, maxLength: 5 },
- news_type: { type: String, default: 1, maxLength: 5 },
- origin: { type: String, required: false, maxLength: 200 },
- };
- const schema = new Schema(ThousandSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Thousand', schema, 'market_thousand');
- };
|