123456789101112131415161718192021222324252627282930313233343536373839 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 展会表
- const dock = {
- room_id: { type: String, required: true }, // 房间号
- password: { type: Secret, select: false }, // 密码
- title: { type: String, required: false, maxLength: 200 }, // 对接会标题
- start_time: { type: String, required: true, maxLength: 200 }, // 开始时间
- end_time: { type: String, required: true, maxLength: 200 }, // 结束时间
- province: { type: String, required: false }, // 省
- city: { type: String, required: false }, // 市
- admin: { type: String, required: false, maxLength: 200 }, // 负责人
- phone: { type: String, required: false, maxLength: 200 }, // 负责人电话
- sponsor: { type: String, required: false, maxLength: 200 }, // 主办方
- organizer: { type: String, required: false, maxLength: 200 }, // 承办方
- user_id: { type: ObjectId }, // 创建人
- status: { type: String, default: '0' }, // 0-准备中;1-开始;-1-结束
- remark: { type: String },
- };
- const schema = new Schema(dock, { 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({ sponsor: 1 });
- schema.index({ user_id: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Dock', schema, 'dock');
- };
|