patenttechol.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利需求表
  7. const patenttechol = {
  8. order_num: { type: String }, // 需求订单号
  9. describe: { type: String }, // 需求描述(用途)
  10. urgent: { type: String }, // 紧急程度
  11. contact: { type: String }, // 联系人
  12. phone: { type: String }, // 联系电话
  13. email: { type: String }, // 电子邮箱
  14. requirement: { type: String }, // 合作条件及要求
  15. status: { type: String }, // 状态
  16. remark: { type: String },
  17. };
  18. const schema = new Schema(patenttechol, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.index({ order_num: 1 });
  21. schema.index({ urgent: 1 });
  22. schema.index({ contact: 1 });
  23. schema.index({ phone: 1 });
  24. schema.index({ email: 1 });
  25. schema.index({ status: 1 });
  26. schema.index({ 'meta.createdAt': 1 });
  27. schema.plugin(metaPlugin);
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('Patenttechol', schema, 'patent_techol');
  31. };