123456789101112131415161718192021222324252627282930 |
- '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 dock_user = {
- dock_id: { type: String }, // 展会id
- user_id: { type: String }, // 用户id
- user_name: { type: String }, // 用户姓名
- user_phone: { type: String }, // 用户电话
- create_time: { type: String }, // 申请时间
- productList: { type: Array }, // 参展项目
- status: { type: String, default: '0' }, // 0-待审核;1-审核通过;-1-审核拒绝
- remark: { type: String },
- };
- const schema = new Schema(dock_user, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ dock_id: 1 });
- schema.index({ name: 1 });
- schema.index({ phone: 1 });
- schema.index({ status: 1 });
- schema.index({ user_id: 1 });
- schema.index({ create_time: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('DockUser', schema, 'dockUser');
- };
|