'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { Secret } = require('naf-framework-mongoose/lib/model/schema'); const { ObjectId } = require('mongoose').Types; // 科技频道-视频表 const channel_video = { channel_id: { type: ObjectId }, // 关联的personal的id title: { type: String, required: false, maxLength: 200 }, // 标题 start_time: { type: String, required: false, maxLength: 200 }, // 开始时间 end_time: { type: String, required: false, maxLength: 200 }, // 结束时间 file_path: { type: String, required: false, maxLength: 200 }, // 视频路径 remark: { type: String, maxLength: 200 }, create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') }, }; const schema = new Schema(channel_video, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('ChannelVideo', schema, 'channel_video'); };