12345678910111213141516171819202122232425262728 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
- const { ObjectId } = require('mongoose').Types;
- // 访谈表
- const interview = {
- dock_id: { type: ObjectId },
- title: { type: String, required: false, maxLength: 500 }, // 标题
- publish_time: { type: String, required: false, maxLength: 500 }, // 时间
- origin: { type: String, required: false, maxLength: 500, default: '网站管理员' }, // 来源
- brief: { type: String, maxLength: 100 }, // 简介
- picture: { type: String, required: false }, // 图片
- filepath: { type: String, required: false }, // 视频
- content: { type: String, required: false }, // 正文内容
- remark: { type: String, maxLength: 200 },
- create_time: { type: String },
- };
- const schema = new Schema(interview, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ title: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Interview', schema, 'interview');
- };
|