'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; const { Secret } = require('naf-framework-mongoose-free/lib/model/schema'); // 展会vip表 const dock_vip = { dock_id: { type: ObjectId, required: true }, // 展会id name: { type: String }, // 名称 phone: { type: String, required: false, maxLength: 200 }, // 电话 password: { type: Secret, select: false }, // 密码 email: { type: String, required: false, maxLength: 200 }, // 邮箱 brief: { type: String, required: false, maxLength: 200 }, // 简介 remark: { type: String }, }; const schema = new Schema(dock_vip, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ dock_id: 1 }); schema.index({ name: 1 }); schema.index({ phone: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('DockVip', schema, 'dockVip'); };