123456789101112131415161718192021222324252627 |
- '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');
- // 展会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('Dock_vip', schema, 'dock_vip');
- };
|