123456789101112131415161718192021222324252627282930313233343536373839 |
- "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 trainlive = {
- room_id: { type: String, required: true }, // 房间号,从3001开始
- password: { type: Secret, select: false }, // 密码
- title: { type: String, required: false }, // 标题
- start_time: { type: String, required: true }, // 开始时间
- end_time: { type: String, required: true }, // 结束时间
- province: { type: String, required: false }, // 省
- city: { type: String, required: false }, // 市
- admin: { type: String, required: false }, // 负责人
- phone: { type: String, required: false }, // 负责人电话
- sponsor: { type: String, required: false }, // 主办方
- organizer: { type: String, required: false }, // 承办方
- brief: { type: String, required: false }, // 信息简介
- status: { type: String, default: "0" }, // 0-准备中;1-开始;-1-结束
- role: { type: String, required: false, default: "8" }, // 角色
- remark: { type: String },
- };
- const schema = new Schema(trainlive, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ room_id: 1 });
- schema.index({ title: 1 });
- schema.index({ start_time: 1 });
- schema.index({ end_time: 1 });
- schema.index({ admin: 1 });
- schema.index({ status: 1 });
- schema.index({ "meta.createdAt": 1 });
- schema.plugin(metaPlugin);
- module.exports = (app) => {
- const { mongoose } = app;
- return mongoose.model("TrainLive", schema, "trainLive");
- };
|