123456789101112131415161718192021222324252627282930 |
- '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 dock_user = {
- dock_id: { type: ObjectId, required: true }, // 展会id
- user_id: { type: ObjectId }, // 申请人
- name: { type: String }, // 名称
- phone: { type: String, required: false, maxLength: 200 }, // 电话
- 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('Dock_user', schema, 'dock_user');
- };
|