'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 declare = { company: { type: String }, // 申请单位 apply_person: { type: String }, // 申请人 phone: { type: String }, // 联系电话 material: { type: Array }, // 审核资料 medium_id: { type: ObjectId }, // 中介机构id medium_material: { type: Array }, // 中介机构审核资料 contract: { type: Array }, // 合同 is_cashing: { type: String, default: '0' }, // 是否兑付 status: { type: String, default: '0' }, // 0-待审;1-通过;2-拒绝 // 0-初审; // 1-初审通过(企业,中介上传合同);-1-初审失败; // 2-高企申报成功;-2:高企申报失败 record: { type: Array }, remark: { type: String }, user_id: { type: ObjectId }, // 用户id }; const schema = new Schema(declare, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ company: 1 }); schema.index({ apply_person: 1 }); schema.index({ medium_id: 1 }); schema.index({ is_cashing: 1 }); schema.index({ status: 1 }); schema.index({ user_id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Declare', schema, 'declare'); };