123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 展会视频表
- const videos = new Schema({
- file_path: { type: String, required: true }, // 视频路径
- videointro: { type: String, required: false, maxLength: 200 }, // 视频文件标题
- videointroinfo: { type: String, required: false, maxLength: 200 }, // 视频文件简介
- });
- // vip用户
- const vipuser = new Schema({
- vipname: { type: String, required: false, maxLength: 200 }, // 用户名称
- vipphone: { type: String, required: false, maxLength: 200 }, // 联系人手机
- email: { type: String, required: false, maxLength: 20 }, // 郵箱
- content: { type: String, required: false }, // 内容
- password: { type: String, select: false }, // 密码
- });
- vipuser.index({ id: 1 });
- // 展会表
- const dock = {
- room_id: { type: Number, required: true, maxLength: 10 }, // 房间号
- 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 }, // 省
- place: { type: String, required: false }, // 市
- adminuser: { 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 }, // 承办方
- videodata: { type: [ videos ], select: true }, // 视频路径
- vipuser: { type: [ vipuser ], default: [] }, // vip用户
- desc: { type: String, maxLength: 1000 }, // 简介
- status: { type: String, default: '0' }, // 状态:0准备中;1已开始;2已结束
- remark: { type: String, maxLength: 200 },
- create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
- };
- const schema = new Schema(dock, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Dock', schema, 'dock');
- };
|