channel_video.js 1.1 KB

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  6. const { ObjectId } = require('mongoose').Types;
  7. // 科技频道-视频表
  8. const channel_video = {
  9. channel_id: { type: ObjectId }, // 关联的personal的id
  10. title: { type: String, required: false, maxLength: 200 }, // 标题
  11. start_time: { type: String, required: false, maxLength: 200 }, // 开始时间
  12. end_time: { type: String, required: false, maxLength: 200 }, // 结束时间
  13. file_path: { type: String, required: false, maxLength: 200 }, // 视频路径
  14. remark: { type: String, maxLength: 200 },
  15. create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
  16. };
  17. const schema = new Schema(channel_video, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ 'meta.createdAt': 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('ChannelVideo', schema, 'channel_video');
  24. };