1234567891011121314151617181920212223242526 |
- '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 channel_video = {
- channel_id: { type: String }, // 关联的channel的id
- title: { type: String }, // 标题
- start_time: { type: String }, // 开始时间
- end_time: { type: String }, // 结束时间
- video_url: { type: Array }, // 视频文件
- remark: { type: String },
- create_time: { type: String },
- };
- const schema = new Schema(channel_video, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ channel_id: 1 });
- schema.index({ title: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('ChannelVideo', schema, 'channelVideo');
- };
|