'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 需求表 const DemandSchema = { name: { type: String, required: true, maxLength: 200 }, // 需求技术名称 field: { type: String, required: false, maxLength: 200 }, // 所属领域 budget: { type: String, required: false, maxLength: 200 }, // 拟投入预算 (万) enddate: { type: String, required: false, maxLength: 200 }, // 需求截止日期 problem: { type: String, required: false, maxLength: 500 }, // 难题或瓶颈问题 condition: { type: String, required: false, maxLength: 500 }, // 企业解决技术需求已具备的条件 type: { type: String, required: false, maxLength: 200 }, // 合作方式 uid: { type: String, required: true, maxLength: 200 }, // 发布人用户id is_display: { type: String, required: true, maxLength: 200 }, // 是否在网页上显示,0-显示,1-不显示 status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-草稿,1-未审核,2-已审核 }; const schema = new Schema(DemandSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Demand', schema, 'demand'); };