12345678910111213141516171819202122232425262728 |
- '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 { ObjectId } = require('mongoose').Types;
- // 展会-用户表
- const dockUser = {
- dock_id: { type: ObjectId }, // 展会id
- user_id: { type: ObjectId, required: true }, // 用户id
- user_name: { type: String, required: true, maxLength: 200 }, // 用户名称
- goodsList: { type: [ Object ], default: [] }, // 产品列表
- contact_tel: { type: String, required: false, maxLength: 200 }, // 联系人电话
- apply_time: { type: String, maxLength: 200 }, // 申请时间
- // role: { type: String, maxLength: 200 }, // 申请人类型
- status: { type: String, default: '0', maxLength: 1 }, // 申请状态 (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(dockUser, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ dock_id: 1 });
- schema.index({ status: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Dock_user', schema, 'dock_user');
- };
|