channelVideo.js 992 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
  6. const { ObjectId } = require('mongoose').Types;
  7. // 科技频道-视频表
  8. const channel_video = {
  9. channel_id: { type: String }, // 关联的channel的id
  10. title: { type: String }, // 标题
  11. start_time: { type: String }, // 开始时间
  12. end_time: { type: String }, // 结束时间
  13. video_url: { type: Array }, // 视频文件
  14. remark: { type: String },
  15. create_time: { type: String },
  16. };
  17. const schema = new Schema(channel_video, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ channel_id: 1 });
  20. schema.index({ title: 1 });
  21. schema.index({ 'meta.createdAt': 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('ChannelVideo', schema, 'channelVideo');
  26. };