trainLive.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 trainlive = {
  9. room_id: { type: String, required: true }, // 房间号,从3001开始
  10. password: { type: Secret, select: false }, // 密码
  11. title: { type: String, required: false }, // 标题
  12. start_time: { type: String, required: true }, // 开始时间
  13. end_time: { type: String, required: true }, // 结束时间
  14. province: { type: String, required: false }, // 省
  15. city: { type: String, required: false }, // 市
  16. admin: { type: String, required: false }, // 负责人
  17. phone: { type: String, required: false }, // 负责人电话
  18. sponsor: { type: String, required: false }, // 主办方
  19. organizer: { type: String, required: false }, // 承办方
  20. brief: { type: String, required: false }, // 信息简介
  21. status: { type: String, default: "0" }, // 0-准备中;1-开始;-1-结束
  22. role: { type: String, required: false, default: "8" }, // 角色
  23. remark: { type: String },
  24. };
  25. const schema = new Schema(trainlive, { toJSON: { virtuals: true } });
  26. schema.index({ id: 1 });
  27. schema.index({ room_id: 1 });
  28. schema.index({ title: 1 });
  29. schema.index({ start_time: 1 });
  30. schema.index({ end_time: 1 });
  31. schema.index({ admin: 1 });
  32. schema.index({ status: 1 });
  33. schema.index({ "meta.createdAt": 1 });
  34. schema.plugin(metaPlugin);
  35. module.exports = (app) => {
  36. const { mongoose } = app;
  37. return mongoose.model("TrainLive", schema, "trainLive");
  38. };