demand.js 1.3 KB

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